问题: 本人有两个gitee账号,在一台电脑同时管理两个账号的项目,此时gitee提示公钥已被使用,如下图
解决方法:
1.生成密钥对是指定密钥对名称即可
ssh-keygen -t rsa -C "your_email@163.com" -f ~/.ssh/id_rsa_one
ssh-keygen -t rsa -C "your_email@163.com" -f ~/.ssh/id_rsa_two
2.新建密钥对配置文件
vi ~/.ssh/config
# one
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_one
# two
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_two
3.测试是否配置成功
ssh -T git@gitee.com
出现上图则证明配置ok