git clone 提示“WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED“问题原因及解决方法

871次阅读
没有评论

github 配置了 ssh 密钥,一般也是通过 SSH 模式 clone 项目代码,

今天在 GitHub 拉取项目代码提示

$ ssh -T git@github.com
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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/PC/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/PC/.ssh/known_hosts:1
RSA host key for github.com has changed and you have requested strict checking.
Host key verification failed.

问题原因

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

翻译过来就是
警告:远程主机标识已更改!

此报错是由于远程的主机的公钥发生了变化导致的。
ssh 服务是通过公钥和私钥来进行连接的,它会把每个曾经访问过计算机或服务器的公钥(public key),记录在~/.ssh/known_hosts 中,当下次访问曾经访问过的计算机或服务器时,ssh 就会核对公钥,如果和上次记录的不同,OpenSSH 会发出警告。

解决方法

删除电脑上的 known_hosts 相关信息

ssh 默认生成密钥的文件路径 C:\Users\PC\.ssh

git clone 提示“WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED“问题原因及解决方法

参考链接:https://blog.csdn.net/GX_1_11_real/article/details/82153160

正文完
有偿技术支持加微信
post-qrcode
 
评论(没有评论)
验证码