Git version: 2.13.0.windows.1
OS: Windows 7
CLI: Git bash
.gitconfig
[user] name = Gyandeep Singh email = [email protected] [push] default = current [core] autocrlf = input [includeIf "gitdir: ~/Documents/webstorm/corporate/"] path = .gitconfig-work .gitconfig-work
[user] name = Gyandeep Singh email = [email protected] What happened: open CLI on a folder (example test) inside corporate folder and then run git config user.email the output is [email protected].
Expected: Outcome should be [email protected].
Am I doing something wrong or my expectation is not correct? I did follow the git docs.
You have to run git config --show-origin --get user.email on a git initialized directory. If its not git initialized then the includeIf gitdir functionality will not work.
Its strange but true. I wish it still worked.
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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With