Git 2.13 conditional config on windows

You need to turn off case sensitivity: change "gitdir:" to "gitdir/i:"

[includeIf "gitdir/i:C:/Work/"]
path = .gitconfig-work

[includeIf "gitdir/i:C:/My/Dev/"]
path = .gitconfig-my

from:

https://github.com/Microsoft/vscode/issues/62921#issuecomment-437693020


Your global C:/Users/<user-name>/.gitconfig should have this includeIf:

[includeIf "gitdir:C:/Users/<user-name>/Documents/webstorm/corporate/"]
    path = .gitconfig-work

with having your work Git repos in C:/Users/<user-name>/Documents/webstorm/corporate and the conditional work configuration should be located at C:/Users/<user-name>/.gitconfig-work.

That's at least working for me in Window's cmd and Cmder. A git config --show-origin --get user.email should than show you from where a config value is loaded/resolved.

It also seems like the conditional work configuration is only used when issued from within a Git repository.

C:\Users\<user-name>\Documents\webstorm\corporate
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig  [email protected]

C:\Users\<user-name>\Documents\webstorm\corporate\some-repo
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig-work  [email protected]

C:\Users\<user-name>\Documents\webstorm\corporate\some-non-repo-dir
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig  [email protected]