最近我开始在我的 git 配置中使用 includeIf 功能来处理不同项目的多个 git 用户帐户,但我遇到了一个让我发疯的问题。
脚本的 includeIf 部分似乎覆盖了主 git 配置文件。即使我没有在应该应用它的地方使用 repo。
这是我的.gitconfig
:
[user]
name = Default Gitlab
email = default.gitlab@project1.com
[includeIf "gitdir:~/repos/project2/"]
path = ~/.gitconfig-github
还有.gitconfig-github
[user]
name = Another Github
email = another.github@project2.com
问题是一段时间后我的 .gitconfig
看起来像这样:
[user]
name = Another Github
email = another.github@project2.com
[includeIf "gitdir:~/repos/project2/"]
path = ~/.gitconfig-github
我真的不明白为什么或如何发生这种情况。
感谢您的帮助!
########
# Edit #
########
我注意到并不是 includeIf
正在这样做。
每次我的 repo 本地 git 配置发生更改时,似乎都会发生更改。
还在摸索中...