bitbucket/github上多个帐户的多个ssh密钥不起作用
尽管在这个话题上有很多问题,我还是很难找到这份工作。要么我错过了什么,要么他们不是我想要的 我在github上有两个帐户-bitbucket/github上多个帐户的多个ssh密钥不起作用,git,ssh,Git,Ssh,尽管在这个话题上有很多问题,我还是很难找到这份工作。要么我错过了什么,要么他们不是我想要的 我在github上有两个帐户-account1和account2及其各自的存储库 git@bitbucket.org:account1/repo.git git@bitbucket.org:account2/repo.git 在我的电脑上,我为每个account1\u id\u rsa和account1\u id\u rsa 当我将它们命名为id\u rsa时,它们各自工作,默认情况下,它们都工作。但我
account1
和account2
及其各自的存储库
git@bitbucket.org:account1/repo.git
git@bitbucket.org:account2/repo.git
在我的电脑上,我为每个account1\u id\u rsa
和account1\u id\u rsa
当我将它们命名为id\u rsa
时,它们各自工作,默认情况下,它们都工作。但我希望能够将它们的密钥命名为account1\u id\u rsa
和account1\u id\u rsa
,并且仍然能够推/拉,而无需根据我目前要处理的回购协议对每个密钥进行重命名
在阅读了很多关于这个主题的QA之后,我仍然不知道在我的.ssh\config
中应该放什么。到目前为止我已经试过了
Host bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account2_id_rsa
User account2
在这里找到了答案
最重要的是,我需要有以下git URL
git@account1.bitbucket.org:repo.git
git@account2.bitbucket.org:repo.git
也在,和
Host account1.bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account1_id_rsa
Host account2.bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/account2_id_rsa
git@account1.bitbucket.org:repo.git
git@account2.bitbucket.org:repo.git