对 git 配置使用 INCLUDE

Using INCLUDE for git config

关于Changing .gitconfig location on Windows, Joe Brinkman gave this answer, 的问题。

对于组织将网络目录声明为 $HOME 目录的用户,他的回答似乎是最合乎逻辑的,因为它可以与 Git 工具一起使用,而无需尝试重​​新定义环境变量(许多用户没有管理员权限来完成)。

如何正确使用 Git 中的 INCLUDE 工具将 .gitconfig 文件指向另一个位置?我的代码:

[include]
path = c:\users\userid\.mygitconfig

当我去检查它是否有效时,我得到一个 fatal: bad config line 2 in file H://.gitconfig 错误。

我发现我的代码存在语法错误。由于 GitBash 环境的 LINUX 基础。 LINUX 在路径中使用正斜杠,而我使用的 Windows copy/paste 有反斜杠。 不正确:

[include]
path = c:\users\userid\.mygitconfig

应该是:

[include]
path = c:/users/userid/.mygitconfig