有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,GitHub存储库存在,我不知道现在该做什么。
> git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,GitHub存储库存在,我不知道现在该做什么。
> git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
当前回答
对我来说,我试过这个
eval "$(ssh-agent -s)"
然后我就跑
ssh-add ~/.ssh/path-to-the-keyfile
为了生成密钥,你可以运行
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
这将生成一对密钥(Public和private)。
您可以将此密钥存储到github以了解更多信息,添加一个新的SSH密钥到您的github帐户
我希望它能帮助到其他人:)
其他回答
我也有同样的问题,但没有一个答案有效,但一个简单的解决方案有效。但是请注意,我确实首先添加了答案所建议的ssh密钥。不知道这是否真的有用。总之,这是最后成功的方法:
使用git远程将远程的URL从HTTPS更改为SSH set-url命令。$ git remote set-url origin git@github.com:USERNAME/REPOSITORY.git。验证远程URL 已经改变了。
我在ssh代理中加载了2个Github身份文件。我的个人钥匙和另一把客户项目的钥匙。
我删除了引起混乱的关键:
Ssh-add -d id_rsa_github_somekey . sh
我试图用几个小时来解决类似的问题。最后,我删除了所有的密钥,并创建了没有密码的新密钥,最终摆脱了这个问题。
问题是SSH密码,需要删除!
我得到了这个错误。原来我刚刚将OSX升级到Sierra,我的旧密钥不再注册了。
一开始我以为是“升级到macOS Sierra会破坏你的SSH密钥并将你锁在自己的服务器之外”
但我避开了这个问题。结果我只需要重新注册我现有的密钥:
ssh-add - k
然后输入密码…完成了!
排除故障的步骤
这发生在SourceTree上 在我的例子中,我的公私钥对出了问题。所以我删除这对并生成一个新的来解决我的问题