saber 酱的抱枕

Fly me to the moon

03/26
2023
软件

GitHub 提示 REMOTE HOST IDENTIFICATION HAS CHANGED!

刚才我在提交到 GitHub 仓库时看到提示 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! ,这么多年头一次遇到,搜索了一下发现是 GitHub 修改了它的 SSH key,所以以前的 key 失效了。

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:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in /c/Users/xxxxx/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/xxxxx/.ssh/known_hosts:1
Host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

解决方法是执行 ssh-keygen -R github.com 删除之前保存的 key,或者打开 known_hosts 文件手动删除 github.com 所在的行。然后重新执行 git 操作,就可以获得新的 key,确认继续连接即可。
来自:https://stackoverflow.com/a/75830784

GitHub 提示 REMOTE HOST IDENTIFICATION HAS CHANGED!