在关于 Changing .gitconfig location on Windows 的问题中,Joe Brinkman 给出了这个答案,https://stackoverflow.com/a/37755334/9486497 .
对于组织将网络目录声明为其 $HOME 目录的用户,他的回答似乎是最合乎逻辑的,因为它与 Git 工具一起工作,而无需尝试重新定义环境变量(许多用户将没有管理员权限来完成)。
如何正确使用 Git 中的 INCLUDE 工具将 .gitconfig 文件指向另一个位置?我的代码:
[include]
path = c:\users\userid\.mygitconfig
当我去检查它是否工作时,我得到一个 fatal: bad config line 2 in file H://.gitconfig
错误。
最佳答案
我发现我的代码存在语法错误。由于 GitBash 环境的 LINUX 基础。 LINUX 在路径中使用正斜杠,而我使用的 Windows 复制/粘贴有反斜杠。 不正确:
[include]
path = c:\users\userid\.mygitconfig
应该是:
[include]
path = c:/users/userid/.mygitconfig
关于linux - 对 git 配置使用 INCLUDE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49261467/