SSH链接失败提示REMOTE HOST IDENTIFICATION HAS CHANGED

前言

昨天在使用Git推送代码的时候, 莫名其妙突然报错,提示:

1
2
3
4
5
6
7
8
9
10
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMc
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:3

解决方案

  1. 第一种 直接删除.ssh目录下的known_hosts文件

  2. 第二种 修改.ssh目录下的config配置文件, 添加如下配置:

    1
    2
    StrictHostKeyChecking no  # 不进行主机检查
    UserKnownHostsFile /dev/null #不保存在known_hosts中
  3. 第三种 只删除known_hosts文件中对应ip的相关rsa信息

本文为作者原创转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

0%