I’m using the same computer for development on multiple projects, some private, some not, but I can’t use the same git user name for all the different repositories, so I found out you can have different .gitconfig files, based on which folder you repository is located in.
Here is how to do it;
First create the different config files, one for each folder.
.gitconfig-work
Bash
[user]
  email = workEmail@work.com
  name = workName
[core]
  autocrlf = input
[credential]
  helper = store.gitconfig-private
Bash
[user]
  email = privateEmail@private.com
  name = privateName
[core]
  autocrlf = input
[credential]
  helper = storeAnd now the .gitconfig
Bash
[includeIf "gitdir:~/workFolder/"]
path = ~/.gitconfig-work
[includeIf "gitdir:~/privateFolder/"]
path = ~/.gitconfig-privateWhen you now push to repositories located in privateFolder the name privateName will be used, and for the folder workFolder the name workName is used.