ssh连接出现WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
问题描述
在使用ssh连接远程服务器的时候,会出现以下提示信息,然后链接断掉
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 ED25519 key sent by the remote host is
SHA256:+DiY3wvvVxxxhbpZisF/zLxxxzPMSvHdkxxx4UvCOqU.
Please contact your system administrator.
Add correct host key in /Users/xxx/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /Users/xxx/.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.Please make sure you have the correct access rights
and the repository exists.
解决方法
切换到home
目录下的.ssh
,找到known_hosts
文件,可能还有一个known_hosts.old
的文件。
直接将这两个文件删除,或者是更换名字,比如known_hosts.bak
,或者是移动到其他目录里备份,如果你怕出问题,建议备份,然后再重新ssh进行连接即可