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:

To make sure you changed the user.name and user.email locally properly, write the following:

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:

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:

I hope this could help.

mhmd

Hello, I'm Mohammad Daka, software engineer who love coding. In my spare time I blogs about JavaScript,PHP, Chrome Extensions, helpful resources and tools, I'm also working on my own projects. Don't hesitate to contact me at my twitter account: @mohammad_daka :)

Leave a Reply

Your email address will not be published. Required fields are marked *