【git】 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED

  • "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!",这表明你尝试连接的服务器的 SSH 主机密钥已经发生了变化。这通常发生在服务器重新安装、SSH 服务更换密钥或者服务器 IP 地址被重新分配给另一台服务器的情况下。

known_hosts to get rid of this message.

bash 复制代码
 git push --all perf
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ED259 key sent by the remote host is
SHA256:dXeecJYdzfc+8.
Please contact your system administrator.
Add correct host key in /c/Users/zhangbin/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /c/Users/zhangbin/.ssh/known_hosts:21
Host key for 192.168.50.197 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.

删掉known_hosts 第21行

  • 要解决这个问题,你需要更新你的本地 known_hosts 文件,从中移除旧的主机密钥。这样做可以消除安全警告,但在执行此操作前,请确保更改是合法的,确实是由于服务器或其配置发生了更改,而不是中间人攻击。

编辑 known_hosts 文件:

该错误信息指出了有问题的密钥在 known_hosts 文件中的位置(本例中为第21行)。

打开该文件,通常位于用户目录下的 .ssh 文件夹内(/c/Users/zhangbin/.ssh/known_hosts),并删除第21行。

在 Windows 系统中,你可以使用文本编辑器打开该文件,例如使用 Notepad:

notepad /c/Users/zhangbin/.ssh/known_hosts

  • 从 known_hosts 文件中移除条目:

  • 找到第21行,删除它。保存并关闭文件。

重新连接:

尝试再次执行 git push 或 ssh 命令。系统会询问你是否接受新的主机密钥,输入 yes 确认。

这将添加新的主机密钥到 known_hosts 文件,并且应该解决错误。

相关推荐
嘻嘻仙人2 天前
Ubuntu中 git上传自己的项目和二次上传一般流程
git·github
Patrick_Wilson2 天前
Squash Merge 的血缘陷阱:为什么删掉的代码又活了过来
前端·git·程序员
沉浸学习的匿名网友2 天前
什么是 .gitignore?为什么每个 Git 项目几乎都离不开它?
前端·git
深海鱼在掘金3 天前
Git 完全指南 —— 第3章:理解工作区、暂存区、版本库三个核心
git
江华森3 天前
Git 基础筑基:从原理到团队协作的全栈实战
git
JakeJiang3 天前
Git 必备命令指南:从日常高频到项目开发实战
git
叫我少年4 天前
Windows 中安装 git
git
深海鱼在掘金9 天前
Git 完全指南 —— 第1章:Git 概览与版本控制演进
git
noravinsc10 天前
关于Git Flow
git
蜜獾云10 天前
在Git中配置用户名和密码
git