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

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

ssh-keygen.png

1.原因:

公钥出现问题

2.解决办法:

(1)在需要提交文件的目录内,重新设置git用户名字和邮箱

git config --global user.name "yourname" #yourname你设置的名字
git config --global user.email "your@email.com" #你的邮箱

git config.png

(2)生成密钥

ssh-keygen -t rsa -C "your@email.com" #填写设置的邮箱
#回车出现:
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/yz/.ssh/id_rsa):  #请按下回车

Enter passphrase (empty for no passphrase): #回车
Enter same passphrase again: #回车

#出现Your public key has been saved in /c/Users/yz/.ssh/id_rsa.pub 表示成功,公钥保存在/c/Users/yz/.ssh/id_rsa.pub
#复制id_rsa.pub内的公钥

ssh-keygen success.png

(3)打开github,进入设置

点击左侧的 SSH and GPG keys,新建ssh key,将刚才复制公钥粘贴,然后点击添加即可。

github_key.png
作者:ccku
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。如有问题或建议,请多多赐教,非常感谢。
原文地址:https://www.cnblogs.com/ccku/p/13436714.html