【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 小时前
Git , 本地落后远端
git
Yusei_05237 小时前
迅速掌握Git通用指令
大数据·git·elasticsearch
qq_3775727716 小时前
git commit - revert + reset + checkout + reorder
git
2301_767233221 天前
Git使用和理解上的一些问题
git
nyf_unknown1 天前
(vue)将文件夹打成tar包, Git Bash(推荐)具体使用
vue.js·git·bash
兔老大RabbitMQ1 天前
Git Revert 特定文件/路径的方法
git
星哥说事2 天前
如何将堡塔云WAF迁移到新的服务器
服务器·git·github
阿政一号2 天前
Git版本控制器
git
妮妮喔妮2 天前
SSH协议的GIT转换
运维·git·ssh
今禾2 天前
Git 日常使用与面试考点详解:从入门到精通
前端·git·面试