Git – local config usage
As a developer you might have multiple open source projects with different accounts, one in Bitbucket and the other in Github.
So if you clone many projects to the same computer and you need to update your remote repository without making any conflict between different user names, you can avoid those conflicts by doing the following:
Once you cloned a project from a remote repository let’s assume Github to your local machine:
navigate to the cloned repository and within it write the username and email you wish locally to that project:
1 2 3 4 5 6 |
git config user.name "your_name" git config user.email "your_email" |
To make sure you changed the user.name and user.email locally properly, write the following:
1 2 3 4 5 |
git config --local --list |
and see if the user.name and user.email as what you have already changed.
Now when you clone another project (assume) from your Bitbucket account, you can do the same way as above with different user.name and user.email.
That way you can see the correct user name foreach commit in each remote repository.
Notice that if you just have one account for all your project, you can rely in the user.name and user.email of your global git config:
1 2 3 4 5 |
git config --global --list |
This command will show you the current user.name and user.email to all projects.
You can update the data the same way as in local, by doing this:
1 2 3 4 5 6 |
git config --global user.name "your_name" git config --global user.email "your_email" |
I hope this could help.