How to use a different email for a group of git repositoriesEdit on GitHub
If you have a folder with multiple repositories that you want your commits use a different email account, but keep using your (personal) one for anything else, you can do it in two steps:
create a new file with the git config that you want to use (not only email, you can change anything) for the repositories. For tidyness, I set it at the repositories folder named
.gitconfigfile uses the ini file format.
[user] email = <your-new-email>
include the file in your
.gitconfigfile, only for the repositories on that folder.
[includeIf "gitdir:~/<your-grouped-repositories-folder>/"] path = ~/<your-grouped-repositories-folder>/gitconfig.ini
Now any commit that you do on the repositories stored under
~/<your-grouped-repositories-folder> folder will be done with the new email.
Don’t forget to register your new email account as an alias on your
Github account or cloud git provider, so
your commits can be binded to your personal account.