之前工作一直使用自己的电脑,连接公司的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