“.gitconfig” in your home directory
If you’re like me, and you wanted to configure a different email for different repo’s the first place you look is ~/.gitconfig. This is the default configuration for git for your account. You can set your default user name there, as well as helper apps and other good stuff. But what if you want to change the email or user name for different repositories?
“git config” from the command line
Once you have a local clone of a git repository there is another config file in <my_repo_location>/.git/config. You can edit that manually, or use git to edit it for you…
$ cd <my_repo_location>
$ git config user.name "My Name"
$ git config user.email "email@example.com"
$ tail -n 3 .git/config
name = My Name
email = firstname.lastname@example.org
You can also edit the global defaults in a similar way…
$ git config --global user.name "My Default Name"
$ git config --global user.email "email@example.com"