完美解决 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

简介: 完美解决 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

拉取代码时报错:

# Mac 报错
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:88E6751+dflNKvWOxzg2/98Vfg+P4ZWErIR7iTckhBM.
Please contact your system administrator.
# 注意这里:/Users/xxx/.ssh/known_hosts   known_hosts的路径
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:2
Host key for gitlab.hapi123.net has changed and you have requested strict checking.
Host key verification failed.
致命错误:无法读取远程仓库。
请确认您有正确的访问权限并且仓库存在。
# windows 报错
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  
@ 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:KuBLGFm/xkm0bpWVSGzQaT1Qqekl74Ui8TWnmtrEwpU.  
Please contact your system administrator.  
# 注意这里:/c/Users/xxx/.ssh/known_hosts   known_hosts的路径
Add correct host key in /c/Users/xxx/.ssh/known_hosts to get rid of this message.  
Offending ED25519 key in /c/Users/xxx/.ssh/known_hosts:3  
Host key for gitlab.hapi123.net 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
  • WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! 翻译过来就是:警告:远程主机标识已更改!

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


当两个设备第一次进行链接时,会在 ~/.ssh/konwn_hosts 中将被连接设备的公钥信息进行保存,后续再次链接时 OpenSSH 会核对公钥来进行一个简单的验证

744a0f02a8c36500a908406a69ed3898.png


  • 【解决方法】找到报错中 known_hosts 的路径,进入该目录,删除掉 known_hostsknown_hosts.old 文件,然后重新执行之前报错的命令,应该会提示是否确定授权,输入 yes 就行了。

另外需要注意线上对应的公钥确实是你本机的 rsa 公钥。

# 进入目录(这个路径在上面的报错中有体现,有注释标记)
$ cd /Users/xxx/.ssh
# 移除文件
$ sudo rm -rf known_hosts known_hosts.old
# 然后再次执行报错的命令

相关文章
【已解决】kex_exchange_identification: Connection closed by remote host fatal: Could not read from
【已解决】kex_exchange_identification: Connection closed by remote host fatal: Could not read from
|
7月前
|
缓存 网络安全 开发工具
Git服务器报错:host key for (ip地址) has changed and you have requested strict checking
Git服务器报错:host key for (ip地址) has changed and you have requested strict checking
543 0
|
7月前
|
缓存 数据安全/隐私保护 Windows
ECDSA host key for ... has changed and you have requested strict checking.Host key verification fail
ECDSA host key for ... has changed and you have requested strict checking.Host key verification fail
|
7月前
|
网络安全
完美解决 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
完美解决 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
2191 0
|
应用服务中间件
Error:Remote staging type or host is not specified.
Error:Remote staging type or host is not specified.
174 0
|
开发工具 git
git push报错:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
git push报错:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
200 0
|
安全 网络安全 开发工具
【已解决】Unable to negotiate with 47.98.49.44 port 22: no matching host key type found. Their offer: ssh
Unable to negotiate with 47.98.49.44 port 22: no matching host key type found. Their offer: ssh
508 0
【已解决】Unable to negotiate with 47.98.49.44 port 22: no matching host key type found. Their offer: ssh
|
数据安全/隐私保护
remote: Support for password authentication was removed on August 13, 2021
remote: Support for password authentication was removed on August 13, 2021
305 0
|
开发工具 git
【Git】WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
【Git】WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
168 0
【Git】WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

热门文章

最新文章