我根据码云的如下教程设置,密匙已经成功了,最后一步:添加后,在终端(Terminal)中输入
ssh -T git@git.oschina.net就出问题了。
提示的问题是:
Warning: the RSA host key for 'gitee.com' differs from the key for the IP address '本机ip地址'
Offending key for IP in /c/Users/xsooy-pc/.ssh/known_hosts:1
Matching host key in /c/Users/xsooy-pc/.ssh/known_hosts:2
Are you sure you want to continue connecting (yes/no)?
我选择yes之后,提示:ssh_packet_read: Connection closed
我在intellij里面提交代码也可以成功,但是每次提交的时候都会提示这个问题,说的密匙不同,这是什么原因呢?难道是我在同一台电脑里面设置了2次ssh密匙吗?但是旧的密匙我已经删除了啊。是不是没有删除干净呢?是不是还要在intellij里面哪里要在设置一下吗?
如何生成ssh公钥
你可以按如下命令来生成sshkey:
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"
Generating public/private rsa key pair...
三次回车即可生成 ssh key
查看你的 public key,并把他添加到码云(Gitee.com) SSH key添加地址
cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....
添加后,在终端(Terminal)中输入
ssh -T git@git.oschina.net
若返回
Welcome to Git@OSC, yourname!
则证明添加成功。
这种问题很简单,请参考下面的链接:
SSH Warning: the RSA host key for differs from the key for the IP address