git push时报错:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

非 Y 不嫁゛ 提交于 2020-01-28 11:56:25

产生报错:

(base) ➜ git:(master) ✗ git 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:LDuDoXBG9Nky4cRdshyAawFHnxCKAzIX+tR5bcCcqZE.
Please contact your system administrator.
Add correct host key in /Users/guoyanan/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/guoyanan/.ssh/known_hosts:8
ECDSA host key for gitlab.ifchange.com 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
and the repository exists.

解决:

  1. 删除known_hosts 文件中有当前ip的那一行:
$ ssh-keygen -R gitlab.ifchange.com
# Host gitlab.ifchange.com found: line 8
/Users/guoyanan/.ssh/known_hosts updated.
Original contents retained as /Users/guoyanan/.ssh/known_hosts.old
  1. 重新push,成功

解决方案参考:How can i get rid of " WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! "


创建分支:

git branch [name]

切换分支:

git checkout [name]
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!