gitlab项目迁移后,克隆至本地出现问题

Cloning into 'autotest_fe2'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for git.n.xxx.com has changed,
and the key for the corresponding IP address 10.108.000.000
has a different value. 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.
Offending key for IP in /Users/wanggonggege/.ssh/known_hosts:6
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:wsa13STT4ruBMRh72sRRyTdY/zjtwBFu2rGA5mdosKY.
Please contact your system administrator.
Add correct host key in /Users/wanggonggege/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/wanggonggege/.ssh/known_hosts:11
RSA host key for git.n.xxx.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.

业务场景:把负责的项目auto从一个老git迁移到新git,在新git上克隆项目代码到本地时,报错如上,无法正常克隆。

报错解析:

警告:检测到可能产生DNS欺骗

项目git上的RSA主机key已经被修改了。这个key和相应的ip地址10.108.000.000 是不同的值。这意味着DNS欺骗已经发生了或者是你的主机IP地址和主机key此时已经改变了。对于ip的攻击型key在你的本地目录/Users/wanggonggege/.ssh/known_hosts:6。

警告:远程主机身份识别已经改变。

一些人可能现在正在监听你(中间人攻击)!也可能是主机key被改变了。

致命的:不能阅读远程仓库。

请确认你拥有正确的权限,并且仓库已存在。

用人话来说就是,这是一种保护你的机制,因为你的ssh会自动记录你访问的所有的key,并且写入~/.ssh/known_hosts中。每次访问的时候他会对照这个文件的key表,key不同会发警告。项目迁移了,两个key必然不同,所以会报错。

解决:删除对应ip的rsa信息就行了。

命令行操作如下:

ssh-keygen -R xxx.xxx.xxx.xxx (服务器ip地址)

开始我的表演:

wanggonggegedeMacBook-Air:autoTest_fe2 wanggonggege$ ssh-keygen -R 10.108.000.000
# Host 10.108.000.000 found: line 6
/Users/wanggonggege/.ssh/known_hosts updated.
Original contents retained as /Users/wanggonggege/.ssh/known_hosts.old

前后对比ssh/known_hosts确实发现  10.108.000.000的记录已经没有了。

可是,貌似是删除的不干净,然后我git clone并不好用,依然报错如上。

我这小暴脾气能忍它么。

直接清空了~/.ssh/known_hosts,当然提前备份了一下,怕出现啥子鬼问题。

清空之后再次git clone,万事大吉。

发布了321 篇原创文章 · 获赞 48 · 访问量 19万+

猜你喜欢

转载自blog.csdn.net/ferrysoul/article/details/103953505