阅读

Git配置多个SSH-Key

software  2020-03-11 11:25

1、生成 gitee SSH-Key;

$ ssh-keygen -t rsa -C 'git@gitee.com' -f ~/.ssh/gitee_id_rsa

2、生成 github SSH-Key;

$ ssh-keygen -t rsa -C 'git@github.com' -f ~/.ssh/github_id_rsa

3、添加配置文件,在 ~/.ssh 目录下新建一个 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

4、测试;

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

内容摘自:gitee.com

广告

【腾讯云】618云上GO!云服务器限时秒杀,1核2G首年95元!
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。

广告

618优惠礼包限时领取,更有2000元飞天会员礼包等你来拿
上云优惠聚集地,云小站专属代金券可叠加产品折扣使用