Git Configuration Multiple usernames and email address


Since Git 2.13, multiple usernames and email addresses could be configured by using a folder filter.

Example for Windows:


Edit: git config --global -e


[includeIf "gitdir:D:/work"]
  path = .gitconfig-work.config    

[includeIf "gitdir:D:/opensource/"]
  path = .gitconfig-opensource.config
  • The order is depended, the last one who matches "wins".
  • the / at the end is needed - e.g. "gitdir:D:/work" won't work.
  • the gitdir: prefix is required.


File in the same directory as .gitconfig

  name = Money
  email =


File in the same directory as .gitconfig

  name = Nice
  email = cool@opensource.stuff

Example for Linux

[includeIf "gitdir:~/work/"]
  path = .gitconfig-work
[includeIf "gitdir:~/opensource/"]
  path = .gitconfig-opensource

The file content and notes under section Windows.