Git 不同的密钥和帐户
有没有办法将ssh配置为对bitbucket(或github)的每个帐户使用不同的密钥 我的意思是,如果我要使用Git 不同的密钥和帐户,git,github,bitbucket,account,Git,Github,Bitbucket,Account,有没有办法将ssh配置为对bitbucket(或github)的每个帐户使用不同的密钥 我的意思是,如果我要使用*。bitbucket:user1ssh应该使用keyid\u rsa.user1和for*。bitbucket:user2应该是userid\u rsa.user2 我已经尝试过这样做: IdentityFile ~/.ssh/id_rsa.user1 IdentityFile ~/.ssh/id_rsa.user2 Host *.bitbucket.org:user1* Id
*。bitbucket:user1
ssh应该使用keyid\u rsa.user1
和for*。bitbucket:user2
应该是userid\u rsa.user2
我已经尝试过这样做:
IdentityFile ~/.ssh/id_rsa.user1
IdentityFile ~/.ssh/id_rsa.user2
Host *.bitbucket.org:user1*
IdentityFile ~/.ssh/id_rsa.user1
User git
Host *.bitbucket.org:user2*
IdentityFile ~/.ssh/id_rsa.user2
User git
但是没有运气 使用ssh,您可以使用
%HOME%/.ssh/config
(这适用于BitBucket或GitHub) 请参见“”作为示例 然后,
git克隆bitbucketu1:repo1
将从user1克隆repo
#User 1 on BitBucket
Host bitbucketu1
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa.user1
#User 2 on BitBucket
Host bitbucketu2
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa.user2