github IDENTIFICATION HAS CHANGED 问题解决

问题描述

github提交时,发生以下错误:

1
2
3
4
5
6
7
8
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
......

问题原因

https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/ 中提到发现GitHub.com 的 RSA SSH private key 被提交到了一个公开的仓库,为了保证用户数据安全,替换了新的密钥。
通过 SSH 与 Github 交互的用户需要替换 ~/.ssh/known_hosts 文件中的旧信息。

解决方法

移除替换 ~/.ssh/known_hosts 文件中的旧信息

ssh-keygen -R github.com

测试

ssh -T git@github.com

Author: jimmy367
Link: http://www.ohtudou.com/2023/04/21/githubupdate/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
支付宝打赏