【git】git拉取项目报错

发布时间 2023-09-06 10:52:25作者: 代码诠释的世界

1、报错现象

> git pull
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:YznZWVrxlfumZbbLHu5yvbAv40PyX//0R31JP/fbGjg.
Please contact your system administrator.
Add correct host key in /c/Users/Administrator/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/Administrator/.ssh/known_hosts:4
Host key for xxx.xxx.xxx 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.

 

2、原因

由于公司gitlab服务器迁移

 

3、解决方案

手动删除 /c/Users/Administrator/.ssh/known_hosts中服务器相关的信息

 

 

4、重新执行拉取代码

git pull

 重新向/c/Users/Administrator/.ssh/known_hosts添加即可