Git 凭据帮助程序导致"repository not found"错误?



刚刚在credential-store:

中遇到了这个Git行为,看起来像是一个bug
$ git pull
Username for 'https://github.com': ...
Password for 'https://...@github.com': ...
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在我工作的repo有正确的用户。电子邮件,它在~/.git-credentials中有一个匹配的条目。它只是不使用那个条目

我在。git文件夹中打开了配置文件。

现在你需要插入:

[credential "https://github.com/yourProjectPath"]
username = yourGithubUsername

之后可以使用:

git config credential.helper store

这将添加到配置文件:

[credendial]
helper = store

确保配置文件末尾有这个部分,并且没有它的副本之前添加的"credential"部分

然后运行:

git pull

并填写您的密码

如果您使用的是Ubuntu Linux,首先要做的是通过git-core/+archive/ubuntu/ppa将Git更新到最新版本。

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update

检查git 2.9.3是否仍然存在问题。


Arun Wilson在评论中提到:

在我的情况下,有两个条目在~/.git-credentials对github.com和第一个是错误的从我拉的repo文件夹

https://username-2:********@github.com    
https://username-1:********@github.com    
https://username-1:*********@gitlab.com   
https://username-1:*********@bitbucket.org

相关内容

最新更新