Git无法克隆,提示WARNING: POSSIBLE DNS SPOOFING DETECTED

在尝试使用SSH协议通过gitclone命令从GitHub克隆仓库时,用户遇到了可能的DNSSpoofing警告和远程主机识别已改变的错误。为了解决这个问题,用户需要删除known_hosts文件中关于github.com的旧密钥,然后重新添加新的主机密钥。这样做可以消除安全警告,允许正常执行git操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本地使用ssh协议,通过git clone命令克隆github远程仓库,提示如下:

192:LearnCode admin$ git clone git@github.com:xxxxxxxx.git

Cloning into 'xxxxx'...

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

The RSA host key for github.com has changed,

and the key for the corresponding IP address xx.xxx.xxx.xxx

is unknown. This could either mean that

DNS SPOOFING is happening or the IP address for the host

and its host key have changed at the same time.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@    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 RSA key sent by the remote host is

SHA256:uNiVTDztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.

Please contact your system administrator.

Add correct host key in /Users/admin/.ssh/known_hosts to get rid of this message.

Offending RSA key in /Users/admin/.ssh/known_hosts:2

RSA host key for github.com 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.

使用ssh-keygen命令删除域的所有密钥:

ssh-keygen  -f  "/Users/admin/.ssh/known_hosts"  -R gtihub.com

 执行命令后:

Are you sure you want to continue connecting (yes/no)? 

输入yes,将主机密钥添加到本地known_hosts文件中:

 github.com,xx.xxx.xxx.xxx ecdsa-sha2-nistp256 AAAAE2VjTDZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=

重新执行git clone,并继续执行提交、推送命令。

参考链接:https://medium.com/@segunadeleye/getting-rid-of-the-warning-possible-dns-spoofing-detected-message-when-connecting-via-ssh-6dddeb59c102 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值