有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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.
当前回答
你需要生成一个SSH密钥(如果你没有的话),并将公钥与你的Github帐户相关联。参见Github自己的文档。
其他回答
我在远程主机上使用git pull寻找类似错误消息的解决方案时发现了这个页面:
$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我通过ssh -AY remote_hostname从本地计算机连接到远程主机。这不是OP问题的解决方案,但对其他遇到这个页面的人很有用,所以把它贴在这里。
注意,在我的例子中,git pull在我的本地机器上工作良好(也就是说,ssh密钥已经设置,并添加到GitHub帐户等)。我通过将这个添加到~/来解决我的问题。Ssh /config在我的笔记本电脑:
Host *
ForwardAgent yes
然后我用ssh -AY remote_hostname重新连接到远程主机,git拉现在工作了。配置中的更改允许将我的ssh对从本地计算机转发到任何主机。ssh的-A选项实际上是在ssh会话中转发它。点击这里查看更多细节。
我在ssh代理中加载了2个Github身份文件。我的个人钥匙和另一把客户项目的钥匙。
我删除了引起混乱的关键:
Ssh-add -d id_rsa_github_somekey . sh
我在之前的一个php项目中使用github。在使用github时,我使用的是ssh而不是https。我把我的机器设置成这样,每次我提交和推送代码时,它会问我的rsa密钥密码。
几天后,我停止了php项目的工作,忘记了我的rsa密码。最近,我开始在一个java项目上工作,并搬到了bitbucket。因为,我忘记了密码,没有办法恢复它,我猜,我决定使用https(推荐)协议的新项目,并得到了同样的错误在问题中询问。
我是怎么解决的?
运行这个命令告诉我的git使用https而不是ssh: Git配置——全局url."https://"。与其使用git: / / 如果有遥控器,移除遥控器 Git远程rm来源 重做一切从git init到git push,它工作!
PS:我还在调试过程中从我的机器上卸载了ssh,以为删除它就能解决问题。是的,我知道!:)
我在'git push'期间得到相同的错误。在客户端,我有两个起源和主人。我拿掉了一个,然后它就正常工作了。
这招对我很管用:
1-删除所有起源
git remote rm origin
(参见https://www.kernel.org/pub/software/scm/git/docs/git-remote.html)
*remote: "管理你所跟踪的分支的存储库集合("remotes")。
*rm: "删除已命名的远程。所有远程跟踪分支和远程配置设置都被删除。”
2-检查所有已删除:
git remote -v
3-添加新的产地主
git remote add origin git@github.com:YOUR-GIT/YOUR-REPO.git
这就是所有的朋友们!