自己在使用 Git 代码托管平台时,往往需要放到多个不同的托管平台里,Gitee、Github、GitCode 等等,不同的网站账号不同,需要生成的密钥也就不同,这里就可以通过配置多平台账号的方式来解决这个问题。
1、生成密钥
输入以下命令生成密钥:
登录后复制
ssh-keygen -t rsa -C "example@"1.
【1】 生成 Gitee 的密钥

【2】生成 Github 的密钥

【3】生成 Gitcode 的密钥

2、配置多账户
在.ssh文件夹下面新建一个命名为config的文件,编辑如下内容
登录后复制
#github
Host
HostName
IdentityFile ~/.ssh/id_rsa_github
User user1
#gitee
Host gitee.com
HostName gitee.com
IdentityFile ~/.ssh/id_rsa_gitee
User user2
#gitcode
Host gitcode.net
HostName gitcode.net
IdentityFile ~/.ssh/id_rsa_gitcode
User user3![请添加图片描述]()1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.3、把公钥输入在 SSH公钥

4、测试是否连接成功
登录后复制
ssh -T git@
ssh -T git@gitee.com
ssh -T git@gitcode.net1.2.3.
测试成功即可!
















