gitee 配置问题

参考文献:https://gitee.com/help/articles/4229#article-header0

之前开发都是用GitLab,配置的ssh都是git.com的域名,但是一旦用到企业的gitee.com域名的开发项目,就需要切换一下;

克隆项目我们都是直接:

git clone 项目地址

由于之前我的ssh配置公钥是gitlab 的,导致我clone  gitee项目就会报错,没权限。

 

在此之前,我们都需要在远程仓库配置ssh公钥,

 这里我配置了两个公钥,一个是gitlab的,一个是gitee的,这就会导致我直接使用的是gitlab的,这时候就需要切换成gitee的,对应项目是在码云上的,也就是gitee.com的,所以我们需要做一个切换,

 在此之前,要先更改config文件

# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee_id_rsa
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_id_rsa

  用ssh命令分别测试

$ ssh -T git@gitee.com
$ ssh -T git@github.com  

切换到gitee     

 ssh -T git@gitee.com

  

结果

终于没问题了

原文地址:https://www.cnblogs.com/jason-hhc/p/13723075.html