React 前端导航

git push 提交代码报错 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED

git push 提交代码报错 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

个人项目遇到的问题,几天没提交代码了,今天做了些优化,准备提交到 github 时出现了问题,错误提示信息如下:

PS D:\workspace\qianduan.shop> git push
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8*****************.
Please contact your system administrator.
Add correct host key in /c/Users/admin/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/admin/.ssh/known_hosts:2
RSA host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

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

如何解决

通过分析错误提示,发现远程主机发送的SHA256值与之前存放于/.ssh/known_hosts不一致,通过删除known_hosts解决。

还有个简单的办法,执行 ssh-keygen -R gitHub.com 命令即可:

C:\Users\admin>ssh-keygen -R github.com
Host github.com found: line 2
C:\Users\admin/.ssh/known_hosts updated.
Original contents retained as C:\Users\admin/.ssh/known_hosts.old

然后再次 git push 推送代码:

PS D:\workspace\qianduan.shop> git push
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Warning: Permanently added 'github.com' (ECDSA) to the list of known hosts.
Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '20.205.243.166'
Offending key for IP in /c/Users/admin/.ssh/known_hosts:5
Are you sure you want to continue connecting (yes/no)? yes
Enumerating objects: 88, done.
Counting objects: 100% (88/88), done.
Delta compression using up to 12 threads
Compressing objects: 100% (56/56), done.
Writing objects: 100% (56/56), 9.83 KiB | 1006.00 KiB/s, done.
Total 56 (delta 38), reused 0 (delta 0)
remote: Resolving deltas: 100% (38/38), completed with 25 local objects.
remote: This repository moved. Please use the new location:
remote:   git@github.com:believeyourself/blogs.git
remote:
remote: GitHub found 52 vulnerabilities on believeyourself/blogs's default branch (11 critical, 24 high, 15 moderate, 2 low). To find out more, visit:        
remote:      https://github.com/believeyourself/blogs/security/dependabot
remote:
To github.com:believeyourself/qianduan.shop.git
   6c06be5..9531285  master -> master

声明:本网站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。邮箱:farmerlzj@163.com。 本站原创内容未经允许不得转载,或转载时需注明出处: 内容转载自: React前端网:https://qianduan.shop/blogs/detail/93

#git#github

相关推荐

GitHub上如何发现优秀开源项目

GitHub上无数的开源项目供我们学习,那么在如此多的项目中,如何找到你想要的,有价值的优秀开源项目呢?本站每个月都会更新以前前端开源项目给大家参考学习,但授人以鱼不如授人以渔,本文将介绍如何在github发现优秀项目,节约我们的时间。

2021年中国开发者755万全球第二,Javascript最受欢迎您,数据来源:GitHub

2021年11月17 日,GitHub发布2021年度报告:全球GitHub开发者用户超过7300万 ,其中 56.8% 来自北美之外的地区。美国开发者最多,共有1355万,中国开发者占 10%,有 755 万,位居全球第二。