有人看到这个错误并知道该怎么做吗?

我正在使用终端,我在根,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.

当前回答

我在AWS CodeCommit上也遇到了同样的问题。所有人都在一台笔记本电脑上工作,但另一台却没有。解决方案是在AWS配置部分的.ssh/config中删除'PreferredAuthentications publickey'行。

其他回答

对我来说,我试过这个

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-agent未启用 你可以试试

下载

http://git-scm.com/

安装它 使ssh-agent

C:\Program Files\Git\cmd

start-ssh-agent

这可能是由于您的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密钥上

如果您将ssh访问更改为https访问远程存储库,问题就解决了:

git remote set-url origin https_link_to_repository

git push -u origin master

你需要生成一个SSH密钥(如果你没有的话),并将公钥与你的Github帐户相关联。参见Github自己的文档。