我很难得到这个工作,即使有大量的问题在这个主题。要么我遗漏了什么,要么他们不是我想要的。
我在github上有两个帐户- account1
和account2
及其各自的存储库
git@bitbucket.org:account1/repo.git
git@bitbucket.org:account2/repo.git
在我的PC上,我为每个account1_id_rsa
和account1_id_rsa
创建了2个单独的SSH密钥
当我将它们命名为id_rsa
时,它们都可以单独工作,默认情况下它们都可以工作。但我希望能够保持他们的密钥命名为account1_id_rsa
和account1_id_rsa
,仍然能够推/拉,而不必重新命名每一个取决于哪个回购我想工作的时刻。
在阅读了很多关于这个话题的问答之后,我仍然不知道该在我的.sshconfig
里放什么。到目前为止,我试过
Host bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account2_id_rsa
User account2
Host bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account1_id_rsa
User account1
找到答案了
http://kevinpelgrims.com/blog/2012/07/19/setting-up-multiple-github-accounts-on-windowsHost account1.bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account1_id_rsa
Host account2.bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account2_id_rsa
最重要的是,我需要有以下git url
git@account1.bitbucket.org:repo.git
git@account2.bitbucket.org:repo.git