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

公司用的是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. //成功拉取代码```
网上还有其他方法,没试,不知效果,本方法已亲测可供大家参考。

你可能感兴趣的:(javascript:void(null)gitLab---Host key verification failed.)