Since Git 2.13, multiple usernames and email addresses could be configured by using a folder filter.
Edit: git config --global -e
Add:
[includeIf "gitdir:D:/work"]
path = .gitconfig-work.config
[includeIf "gitdir:D:/opensource/"]
path = .gitconfig-opensource.config
Notes
/
at the end is needed - e.g. "gitdir:D:/work"
won't work.gitdir:
prefix is required.File in the same directory as .gitconfig
[user]
name = Money
email = [email protected]
File in the same directory as .gitconfig
[user]
name = Nice
email = [email protected]
[includeIf "gitdir:~/work/"]
path = .gitconfig-work
[includeIf "gitdir:~/opensource/"]
path = .gitconfig-opensource
The file content and notes under section Windows.