Git 忽略存储在 .git-credentials 中的凭据

Mat*_* Ke 2 git credentials

我有两个本地存储库,它们托管在同一台服务器上,并且我已将 Git 配置为通过以下命令将我的凭据存储在 .git-credentials 文件中。

git config credential.helper store
Run Code Online (Sandbox Code Playgroud)

但是,不输入凭据的 fetch/pull/push 只能在一个存储库中工作。在另一个存储库中,Git 总是要求提供凭据并忽略 .git-credentials 文件。

Mat*_* Ke 5

我已经解决了我的问题。我的配置命令缺少全局选项。如果没有这个选项,我只为一个存储库配置了它。

正确的命令应该是:

git config --global credential.helper store
Run Code Online (Sandbox Code Playgroud)