javailike javailike - 1 month ago 8
Git Question

How to manage multiple projects in git with different emails?

I have a project in GitHub working with git config:

git config --global user.email = "abc@gmail.com"
git config --global user.name = "abc"


Now I need to host another project in git lab, with different email id:

my email account is "xyz@gmail.com"


Do I need to configure anything in git bash, what is the steps I need to do?

If I tried using the same account, I afraid some issue occur

Do I need to change anything?

Answer

For your new repo, all you need to do is, in the repo folder, to do:

git config user.email = "xyz@gmail.com"

The local configuration will override the global one, and your commits will have the right email.

Note: this has nothing to do with the authentication on GitLab.