原WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
摘要:It is also possible that a host key has just been changed.Add correct host key in /Users/havo/.ssh/known_hosts to get rid of this message.
问题背景
之前配置好github ssh后可以正常使用,今天通过ssh,下载git代码时出现以下错误:
Cloning into 'geo'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 /Users/havo/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/havo/.ssh/known_hosts:19
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.
failed to run git: exit status 128
原因分析
因为服务器的ip发生变更了
第一次SSH连接时,会生成一个认证,储存在客户端/Users/havo/.ssh/known_hosts 文件中,但是如果服务器发生变化,认证就会出错。
解决方法
#ssh-keygen -R 这里为github的IP 例如:
ssh-keygen -R 20.205.243.166
# Host 20.205.243.166 found: line 19
/Users/havo/.ssh/known_hosts updated.
手机扫码阅读,舒服~