刚刚遇到了这个 Git 行为,它看起来像是凭证存储的错误:
$ git pull
Username for 'https://github.com': ...
Password for 'https://[email protected]': ...
Already up-to-date.
$ git config credential.helper store
$ git pull
remote: Repository not found.
然后,去编辑 .git/config 以删除[credential] helper = store
git pull 再次工作。
什么可能导致它?
如何使用凭据助手而不遇到此错误?
UPDATE在 Ubuntu 14.04 上使用 git 版本 1.9.1
UPDATE使用 git 版本 2.9.3 重新测试,结果相同。
UPDATE我在 github 上有几个帐户,位于 ~/.git-credentials 中。我使用 GIT_CURL_VERBOSE=1 GIT_TRACE=1 运行 git,看起来它按照列出的顺序选择了第一个 github 帐户。
但是,我正在使用的存储库中的 .git/config 具有正确的 user.email,它在 ~/.git-credentials 中确实有匹配的条目。它只是不使用该条目。
对我有用的是在 .git 文件夹中我打开了配置文件。
现在您需要插入:
[credential "https://github.com/yourProjectPath"]
username = yourGithubUsername
之后您可以使用:
git config credential.helper store
这会将其添加到配置文件中:
[credendial]
helper = store
确保配置文件末尾有此部分并且没有重复的部分before您之前添加的“凭据”部分
然后运行:
git pull
并填写您的密码。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)