javascript:void(null)gitLab---Host key verification failed.

weixin_34019929發表於2016-09-13

公司用的是GitLab,突然發現pull和push程式碼都報錯:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:fyz9pKs5X55RS646N75q+q2/MUVXfl82TmKO2P52+do.
Please contact your system administrator.
Add correct host key in /Users/zhaolu/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/zhaolu/.ssh/known_hosts:1
ECDSA host key for git.dev.jhb.net has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.```

然後管伺服器的同事告訴我,**伺服器的IP變了**。

解決辦法是**刪除known_hosts檔案**(具體路徑上面有提示)。

zhaoludeMacBook-Pro:test zhaolu$ rm /Users/zhaolu/.ssh/known_hosts //刪除hosts
zhaoludeMacBook-Pro:test zhaolu$ ls /Users/zhaolu/.ssh/known_hosts
ls: /Users/zhaolu/.ssh/known_hosts: No such file or directory //刪除乾淨了
zhaoludeMacBook-Pro:test zhaolu$ git pull upstream master //拉取程式碼
The authenticity of host 'git.dev.test.net (60.205.126.31)' can't be established.
ECDSA key fingerprint is SHA256:fyz9pKs5X55RS646N75q+q2/MUVXfl82TmKO2P52+do.
Are you sure you want to continue connecting (yes/no)? yes //這裡填yes
Warning: Permanently added 'git.dev.test.net,60.205.126.31' (ECDSA) to the list of known hosts.
From git.dev.test.net:iOS/test

  • branch master -> FETCH_HEAD
  • [new branch] master -> upstream/master
    Already up-to-date. //成功拉取程式碼```
網上還有其他方法,沒試,不知效果,本方法已親測可供大家參考。

相關文章