git报错:Please make sure you have the correct access rights and the repository exi

比眉伴天荒 2021-09-01 05:38 1291阅读 0赞

前言

今天在用idea push更新到github上时报错Please make sure you have the correct access rights and the repository exists,原来是ssh key有问题,连接不上服务器,这里记录一下解决办法

(ง •_•)ง

format_png

解决

1. 重新在git设置一下身份的名字和邮箱

cmd|powershell| bash进入要提交的目录下,然后

git config --global user.name "yourname"

git config --global user.email“your@email.com"

注:yourname是你要设置的名字,your@email是你要设置的邮箱。

2. 删除.ssh文件夹(直接搜索该文件夹)下的known_hosts,删除

(mac端很多同学不知道.ssh文件夹在哪,参考:https://blog.csdn.net/u014361280/article/details/79361509)

3. git bash输入命令

ssh-keygen -t rsa -C “your@email.com”(请填你设置的邮箱地址)

就像这样,然后一直回车就行了

format_png 1

打开提示的 /c/Users/Acer/.ssh/

format_png 2

id_rsa是私钥,要保管好,id_rsa.pub是公钥,复制里面的内容

4. 打开giuhub进行配置

右上角图标-> settings-> SSH and GPG keys

format_png 3

format_png 4

把公钥粘贴进去

format_png 5

5. 重新push

format_png 6

成功 YEAH! ^o^y

希望对你有帮助

发表评论

表情:
评论列表 (有 0 条评论,1291人围观)

还没有评论,来说两句吧...

相关阅读