背景在gitee上有多个项目,但是需要不同的公钥,部署在同一台服务器上
vim .ssh/config
编辑文件
#account1
Host gitee.com-account1
HostName gitee.com
User git
IdentityFile ~/.ssh/id_rsa1
#account2
Host gitee.com-account2
HostName gitee.com
User git
IdentityFile ~/.ssh/id_rsa2
需要修改git的地址和如上的配置对应才可以
git remote set-url origin git@gitee.com-account1:aaa/bb.git
git remote set-url origin git@gitee.com-account2:cc/dd.git
网友评论