SSH config to access multiple repo not working

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 the setup. I want to connect to 2 remote repos from the same local machine. Setting up the config file was the solution I found over the internet. But somehow I can just use one at a time (the one that was created last). When I try to checkout from another 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 of my public SSH keys are well placed in their respective Bitbucket accounts.

How do I create a config file if needed?

+3


source to share


1 answer


The settings HostName

are incorrect. They should be bitbucket.org

, as you say with this setting, where to actually connect.



There should also be an indentation for the settings for Host

, but there could only be a wiring error here. If it looks like it has been published, that should also be changed. As far as I remember, padding is important and meaningful.

+3


source







All Articles