简体   繁体   English

git push权限被拒绝错误

[英]Permission denied error on git push

So in trying to run 所以在尝试跑步

git push origin master

I got the following prompt: 我得到以下提示:

The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is ...
Are you sure you want to continue connecting (yes/no)?

To which I accidentally said 'no' to. 我对此不小心说了“不”。 Now, I get the following error message when trying to push: 现在,我在尝试推送时收到以下错误消息:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

If anyone could help me figure a way to re-prompt or do it manually, I'd appreciate it greatly! 如果有人可以帮助我找到重新提示或手动完成的方法,我将不胜感激!

NOTE: I'm even getting a Permission denied (publickey). 注意:我什至收到一个Permission denied (publickey).Permission denied (publickey). error when trying the following: 尝试以下操作时出错:

ssh -vT git@github.com

One way would be to delete your ~/.ssh/known_hosts file. 一种方法是删除~/.ssh/known_hosts文件。 That way, ssh will ask you again to verify the authenticity of url. 这样,ssh会再次要求您验证url的真实性。

However, you will be asked to also verify the authenticity of any other url that was already working. 但是,系统还会要求您验证其他所有已在工作的URL的真实性。

EDIT 编辑

Run the following to clean up the entry from your known hosts entries: 运行以下命令从已知主机条目中清除条目:

ssh-keygen -R github.com

You seem to have generated the keys using sudo, so the keys are linked with root account. 您似乎已经使用sudo生成了密钥,因此这些密钥与root帐户关联。 Further, it seems to me that you are trying to connect to github using another non root account, so the ssh keys simply don't match. 此外,在我看来,您正在尝试使用另一个非root帐户连接到github,因此ssh密钥根本不匹配。 I would suggest generating ssh-keys without sudo, and then adding the respective key to your github account. 我建议不使用sudo生成ssh-keys,然后将相应的密钥添加到您的github帐户中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM