Multiple git configurations on your system
Since I now use my personnal computer also for my professionnal activity: I wanted to use two e-mail adresses on the same system: One for my personal activities and an another one dedicated to my company activities.
Since git 2.13 , it is possible to get multiple email addresses on the same system depending on the folder location by using conditional includes.
For example:
If your global config ~/.gitconfig
contains something like:
[user]
name = John Doe
email = john.doe@personal.net
[includeIf "gitdir:~/company_related_folder/"]
path = ~/company_related_folder/.gitconfig
With your work specific configuration ~/company_related_folder/.gitconfig
as:
[user]
email = john.doe@company.com
Remember that [includeIf...]
should follows default [user]
at the top and gitdir should include the last /
.
Thus, git repositories that get cloned onto the ~/company_related_folder/
directory with use the company e-mail adress.