Git:Repository not found.

原帖收藏于IT老兵驿站,传递一个IT老兵在凋零前的光和氧。

Git:服务端更换密码后,报告“remote: Repository not found.”。

昨天Github提醒我需要修改密码,所以我将Github的密码修改了,结果,回到家,在mac笔记本上git pull代码时报告remote: Repository not found.,在网上找了半天,都是在说git路径存在问题,这肯定不是我的问题,我的问题应该就是更换了密码,只不过git 报告了一个奇怪的错误,应该是需要修改本地原本保存的密码。

找到一个帖子说:

分别打开下面2个文件,将[User]部分完全删除后保存,再使用Git命令的时候就会提示输入帐号密码了.
$ vi .git/config (工程当前路径的Git配置文件)

$ vi ~/.gitconfig (全局的Git配置文件)

这里是删除掉了用户信息,不过,不管用。

继续寻找原因:

1
2
xxx$ git config -l
credential.helper=osxkeychain

这里有个变量credential.helper,凭证帮助者,怀疑是这里保存了密码,后面指向了电脑的keychain

查看官网解释:

credential.helper
Specify an external helper to be called when a username or password credential is needed; the helper may consult external storage to avoid prompting the user for the credentials. Note that multiple helpers may be defined. See gitcredentials[7] for details.

这里确认了,这里是外部的一个凭证助手,用来保存用户名和密码。

然后找到mac的keychain(钥匙串访问),果然发现了一条Github的条目,这里应该保存在原本的用户名和密码,把它删掉(这里也是可以直接修改密码的,只是第一次尝试的是删除),这个时候再git pull就出现了提示请输入用户名了,至此,问题解决,相关的疑问也搞明白了。