问题
I'm trying to use the include.path config described here, but I can't seem to find the correct path syntax on Windows.
My current .gitconfig:
[include]
path = 'D:\Scott\Shared\config\common.gitconfig'
But git complains: fatal: bad config file line 2 in C:\Users\Scott/.gitconfig
What's the proper way to escape paths for Windows? Note: I'm using git from Powershell and not git bash.
回答1:
Ok, figured this out. The trick is:
- Surround in double-quotes
- Convert backslashes to forward slashes.
- Begin with drive letter + colon for absolute paths
So the correct version of the above is:
[include]
path = "D:/Scott/Shared/config/common.gitconfig"
回答2:
Based on output of pwd
in git bash, I would speculate it is probably
/d/Scott/Shared/config/common.gitconfig
来源:https://stackoverflow.com/questions/28520565/what-is-the-syntax-for-specifying-windows-paths-in-gitconfig