Issue with ssh keys

Berenice April 18, 2022

Hey there! I have an issue and I've tried everything but still have the same issue. The thing is I have two different bitbucket.org accounts, and I defined ssh key for both of them, the issue is the first ssh key I've created (for one of my accounts) is working but the second one I've created (for the other account I have) is not working. I've trying to differentiate them with the config file but I'm not having success with this, could anyone help me to solve this?

 

Thanks :)

1 answer

1 accepted

0 votes
Answer accepted
Rob van der Lee April 19, 2022

There is not much info that you give here to go off on. However, you can try and debug why the SSH is failing.

A good resource to start would be Atlassian's own troubleshooting guide:

A quick method to debug:

  • Check with `ssh-add -l` what keys are listed in the current keyring
  • Optionally use `ssh-add ~/.ssh/id_rsa_other_key`
  • Check if Bitbucket is in your `~/.ssh/known_hosts` file 
    • You can check the current print in the troubleshooting guide

Other than that I'd say we need some more information on what is going wrong. What do you get back when running the commands?

Berenice April 19, 2022

Hi Rob, thanks for anwering!

*This is the error I get "The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.
fatal: Could not read from remote repository."

*And I have my config file like this 

Host bitbucket.org-berenice_twb
HostName bitbucket.org
User git
IdentifyFile ~/.ssh/twb
IdentitiesOnly yes

Host bitbucket.org-berenicerappachiani
HostName bitbucket.org
User git
IdentifyFile ~/.ssh/professional-bemoon
IdentitiesOnly yes

*Once I added the config file it throws me another error "/home/berenice/.ssh/config: line 4: Bad configuration option: identifyfile
/home/berenice/.ssh/config: line 10: Bad configuration option: identifyfile
/home/berenice/.ssh/config: terminating, 2 bad configuration options
fatal: Could not read from remote repository."

*`ssh-add -l` lists me both ssh keys 

*I'll try adding `~/.ssh/known_hosts`

Berenice April 19, 2022

still not working, thanks anyway Rob

Berenice April 19, 2022

I'VE FOUND A SOLUTION! My problem was Bitbucket wasn't recognizing my shh keys since I have two ssh keys for different Bitbucket accounts, so I found this solution https://support.atlassian.com/bitbucket-cloud/docs/set-up-additional-ssh-keys/ here it explains how to create correctly the additional ssh key (since the first one I've created is the default) to differentiate it from the first one and so Bitbucket will be able to recognize which user corresponds for each key. I hope this helps someone else with the same problem.

Rob van der Lee April 25, 2022

Awesome.  I left for vacation that day but good to see that you found the problem and also updated this ticket with the solution to your problem to help others :)

Like Berenice likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events