首页Linux文章详情

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

By Karida(卡丽妲) / Apr 4, 2023 阅读 0 评论 0 发表于 Linux 字数:1081 阅读时间:11秒

githubssh

摘要:It is also possible that a host key has just been changed.Add correct host key in /Users/havo/.ssh/known_hosts to get rid of this message.

问题背景

之前配置好github ssh后可以正常使用,今天通过ssh,下载git代码时出现以下错误:

  1. Cloning into 'geo'...
  2. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3. @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
  4. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  5. IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
  6. Someone could be eavesdropping on you right now (man-in-the-middle attack)!
  7. It is also possible that a host key has just been changed.
  8. The fingerprint for the RSA key sent by the remote host is
  9. SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
  10. Please contact your system administrator.
  11. Add correct host key in /Users/havo/.ssh/known_hosts to get rid of this message.
  12. Offending RSA key in /Users/havo/.ssh/known_hosts:19
  13. Host key for github.com has changed and you have requested strict checking.
  14. Host key verification failed.
  15. fatal: Could not read from remote repository.
  16. Please make sure you have the correct access rights
  17. and the repository exists.
  18. failed to run git: exit status 128

原因分析

因为服务器的ip发生变更了

第一次SSH连接时,会生成一个认证,储存在客户端/Users/havo/.ssh/known_hosts 文件中,但是如果服务器发生变化,认证就会出错。

解决方法

  1. #ssh-keygen -R 这里为github的IP 例如:
  2. ssh-keygen -R 20.205.243.166
  3. # Host 20.205.243.166 found: line 19
  4. /Users/havo/.ssh/known_hosts updated.

手机扫码阅读,舒服~

⌘ + Return 发表
最新 最早 全部评论0 条评论