【问题标题】:Using INCLUDE for git config使用 INCLUDE 进行 git 配置
【发布时间】:2018-03-13 16:41:10
【问题描述】:

在关于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 错误。

【问题讨论】:

    标签: linux git include code-organization git-config


    【解决方案1】:

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

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

    应该是:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-17
      • 2021-06-20
      • 2010-10-10
      • 1970-01-01
      • 1970-01-01
      • 2011-02-28
      • 2014-07-20
      相关资源
      最近更新 更多