SSH config to access multiple repo not working

故事扮演 提交于 2021-02-09 08:44:07

问题


Here's the config file:

Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa

Host bitbucket-office.org
HostName bitbucket-off.org
User git
IdentityFile ~/.ssh/work_rsa

Host bitbucket-personal.org
HostName bitbucket-per.org
User git
IdentityFile ~/.ssh/personal_rsa

I don't know what's wrong with set up. I want to connect to 2 remote repos from the same local machine. Setting up a config file was the solution I found over the internet. But somehow, I am just able to use one at a time (the one created latest). When I try to pull from other repo it throws the following error:

Agent admitted failure to sign using the key.
repository access denied.
fatal: The remote end hung up unexpectedly

Both my public SSH keys are well posted in respective bitbucket accounts.

How do I make config file run as needed?


回答1:


Your HostName settings are wrong. They should all be bitbucket.org, as you tell with this setting where to actually connect to.

Also there should be indentation for the settings for a Host, but this might just be a posting error here. If it looks like posted though, this should also be chnanged. As far as I remember, the indentation is important and meaningful.



来源:https://stackoverflow.com/questions/43979661/ssh-config-to-access-multiple-repo-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!