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

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

当前回答

这发生在我身上。出于某种原因,我的出身在我没有意识到的情况下被搞砸了:

检查您的设置是否仍然正确

git remote -v

url需要像ssh://git@github.com/YourDirectory/YourProject.git; 如果没有看到git@github.com,请使用

git remote set-url origin git://github.com/YourDirectory/YourProject.git

纠正错误。或者你可以使用github应用程序在特定存储库的设置面板中检查和设置主远程存储库url。

其他回答

你可以试试这种方法……

选择其他链接

这发生在我身上。出于某种原因,我的出身在我没有意识到的情况下被搞砸了:

检查您的设置是否仍然正确

git remote -v

url需要像ssh://git@github.com/YourDirectory/YourProject.git; 如果没有看到git@github.com,请使用

git remote set-url origin git://github.com/YourDirectory/YourProject.git

纠正错误。或者你可以使用github应用程序在特定存储库的设置面板中检查和设置主远程存储库url。

如果您正在使用GitHub for Mac UI,请检查首选项以确保您已登录。

可能您的ssh-agent未启用 你可以试试

下载

http://git-scm.com/

安装它 使ssh-agent

C:\Program Files\Git\cmd

start-ssh-agent

我得到了这个错误。原来我刚刚将OSX升级到Sierra,我的旧密钥不再注册了。

一开始我以为是“升级到macOS Sierra会破坏你的SSH密钥并将你锁在自己的服务器之外”

但我避开了这个问题。结果我只需要重新注册我现有的密钥:

ssh-add - k

然后输入密码…完成了!