我正在尝试使用此处描述的include.path
配置,但在Windows上似乎找不到正确的路径语法。
我当前的.gitconfig:
[include]
path = 'D:ScottSharedconfigcommon.gitconfig'
但git抱怨:fatal: bad config file line 2 in C:UsersScott/.gitconfig
Windows的正确转义路径是什么?注意:我使用的是Powershell中的git,而不是gitbash。
好的,想好了。诀窍是:
- 双引号环绕
- 将反斜杠转换为正斜杠
- 绝对路径以驱动器号+冒号开头
所以上面的正确版本是:
[include]
path = "D:/Scott/Shared/config/common.gitconfig"
根据git-bash中pwd
的输出,我推测它可能是
/d/Scott/Shared/config/common.gitconfig