git连接远程仓库时出现Warning: Permanently added the RSA host key for IP address ......

        之前工作一直使用自己的电脑,连接公司的git仓库也是根据公司的地址设置的,但是今天本来想从官方仓库 https://github.com/mybatis/mybatis-3 Fork 出属于自己的仓库,学习一下mybatis的源码的,结果遇到了问题。下面记录一下自己的解决方案,以mac电脑为例。

解决办法:

      1)根据提示的ip,将它添加到自己电脑到hosts文件中,以13.229.188.59为例:

cldeMBP:etc cl$ cat /etc/hosts
127.0.0.1       localhost
127.0.0.1       www.ums.com
127.0.0.1       www.acct.com
13.229.188.59   github.com

     2)之后在重新clone的时候还是不可以,提示:

Cloning into 'mybatis-3'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

首先确定自己的电脑中是否存publickey,

cldeMBP:~ cl$ cd ~/.ssh/
cldeMBP:.ssh cl$ ll
total 24
-rw-------  1 cl  staff  1675 Jul 29  2018 id_rsa
-rw-r--r--  1 cl  staff   403 Jul 29  2018 id_rsa.pub
-rw-r--r--  1 cl  staff  2296 Jul 21 10:02 known_hosts

 

在查看自己电脑的publickey:

cldeMBP:.ssh chenlong$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADA*********************************************************************************n09aCrH 

也是完好的,最后确定是自己在github服务器上的sshkey没有了,好坑,都不知道什么时候删除的,问题找了就好办了,将自己电脑的id_rsa.pub的内容拷贝一下,添加如下:

到这里我们已经把问题解决了,然后就可以clone自己的内容了:

cldeMBP:codeStudy chenlong$ git clone git@github.com:****C/mybatis-3.git
Cloning into 'mybatis-3'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (5/5), done.
Receiving objects:  17% (52736/296531), 18.07 MiB | 16.00 KiB/s

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值