1

I been using bitbucket for a long time of period and never use github alongside with it, Recently I wanted to use github for particular reason. For github I wanted to setup global email that is different from bitbucket global email. is it possible to setup to two different global email address for both accounts and how do I do that?

Arpit Aggarwal
  • 27,626
  • 16
  • 90
  • 108
Govinda Malavipathirana
  • 1,095
  • 2
  • 11
  • 29
  • Are you asking how to set up your gitconfig? – jmargolisvt Oct 20 '18 at 14:26
  • Possible duplicate of [Can I specify multiple users for myself in .gitconfig?](https://stackoverflow.com/questions/4220416/can-i-specify-multiple-users-for-myself-in-gitconfig) – phd Oct 20 '18 at 19:47
  • https://stackoverflow.com/search?q=%5Bgit%5D+global+email – phd Oct 20 '18 at 19:47

2 Answers2

1

You cannot set up two different emails at a global level, but yes you can have it at a repository level.

From the command line, change into the repository directory and set your email address as:

git config user.email "MY_NAME@example.com"

Verify your configuration by displaying your configuration file:

cat .git/config
Arpit Aggarwal
  • 27,626
  • 16
  • 90
  • 108
1

I think that you could achieve that by cloning in 2 different directories. One called bitbucket and one github.

And then using .gitconfig cnditional include to load either the github config or the bitbucket one.

See .gitconfig include documentation

Philippe
  • 28,207
  • 6
  • 54
  • 78