ssh無法連線 WARNING REMOTE HOST IDENTIFICATION HAS CHANGED!

Hhl發表於2017-12-13

今天使用git上傳程式碼時,發現不能ssh連結。終端資訊如下

192:.ssh ******$ ssh -T git@git.****.cn
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for git.****.cn has changed,
and the key for the corresponding IP address 106.75.12.41
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
SHA256:3DFkMLXqjf4eRLOaySyOfODBGv+1n+LjShGA2O8Hvrg.
Please contact your system administrator.
Add correct host key in /Users/weizhongming/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/weizhongming/.ssh/known_hosts:17
ECDSA host key for git.pecoo.cn has changed and you have requested strict checking.
Host key verification failed.
複製程式碼

解決辦法

就是吧~/.ssh/known_hosts裡面的關於這個公鑰或者git地址的哪行刪掉。也就是ssh重新驗證

開啟.ssh目錄
$ cd .ssh
$ open ./
複製程式碼

WechatIMG100.jpeg

修改完成後驗證

$ ssh -T git@git的伺服器地址
複製程式碼

提示是否重新連結,輸入yes

The authenticity of host 'git.pecoo.cn (106.75.12.41)' can't be established.
ECDSA key fingerprint is SHA256:3DFkMLXqjf4eRLOaySyOfODBGv+1n+LjShGA2O8Hvrg.
Are you sure you want to continue connecting (yes/no)? yes
複製程式碼

連線成功

Welcome to GitLab, Houhanglei!
複製程式碼

相關文章