【git】git拉取项目报错Host key verification failed.
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、解决方案
方法1
手动删除 /c/Users/Administrator/.ssh/known_hosts中服务器相关的信息(换成自己的目录)
方法2
执行命令亦可
ssh-keygen -f "/home/test/.ssh/known_hosts" -R "你的服务域名或者ip"
生成新的配对公钥配置即可
4、重新执行拉取代码
git pull
重新向/c/Users/Administrator/.ssh/known_hosts添加即可
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?