有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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.
当前回答
允许对密钥(标识)进行写访问,然后单击“添加密钥”
如果在Windows上,请检查通过SSH使用Github中的更多详细信息。
其他回答
好吧,这个问题有一些解决方案,其中一些可能已经提到过了,但只是把它们放在一起:
确保您的键是存在的,默认情况下是另一个~/。Ssh /文件夹,即id。Rsa和id.rsa.pub 确保密钥有正确的权限,你可以运行chmod: Chmod 600 ~/.ssh/id_rsa . exe Chmod 644 ~/.ssh/id_rsa.pub 确保您的公钥(id_rsa.pub)的内容与远程存储库配置中上传的内容匹配 最后修复ssh代理的问题: ssh-add
更多信息:https://itcodehub.blogspot.com/2015/01/ssh-add-problems-with-ssh-agent-and.html
这种情况会发生在创建存储库后遵循GitHub指示时。Git将指示您使用以下内容添加遥控器。
Git远程添加源git@github.com:<用户>/<项目>.git
将<>中的内容替换为与您的帐户相关的值。
解决方案是删除.git后缀。添加遥控器的操作如下:
Git远程添加origin git@github.com:<用户>/<项目>
这可能是由于您的SSH密钥/ GPG需要在您的组织github或gitbucket站点上更新。 遵循以下步骤来鞋底:
在cmd:键入>> $ ssh-keygen -t rsa -C "your_email@example.com"(结果创建id_rsa和id_rsa.pub) $ ssh-add ~/.ssh/id_rsa 猫~ / . ssh / id_rsa。Pub并复制密钥,然后到你的org bitbucket/ github站点,并将其粘贴到SSH密钥上
我在AWS CodeCommit上也遇到了同样的问题。所有人都在一台笔记本电脑上工作,但另一台却没有。解决方案是在AWS配置部分的.ssh/config中删除'PreferredAuthentications publickey'行。
我在远程主机上使用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会话中转发它。点击这里查看更多细节。