Hey!
I've a private bitbucket account and one of my company.
SourceTree has automatically configured my ssh config file, where each entry (for each account) starts with "Host <username>-Bitbucket".
Since macOS Sierra, it isn't possible anymore to communicate with my bitbucket repos.
If I change the entry to "Host bitbucket.org" it works for the first account, depends on which entry is listed first. For both entries, following settings are configured:
HostName bitbucket.org
User <username>
PreferredAuthentications publickey
IdentityFile /Users/<user>/.ssh/<username>-Bitbucket
UseKeychain yes
AddKeysToAgent yes
Both passphrases are stored correctly in the keychain. I'm using SourceTree by the way, but it's the same in the terminal.
I would be so grateful to you, if you can help me - it's so annoying, the only workaround which i know, call "ssh-add -A" after booting.
Thanks guys!
Hi Andreas, if this issue is also happening to you in the terminal, then it's not caused by Sourcetree :)
To add both your Bitbucket accounts credentials separately, you can follow the instructions in this post Different SSH keys for different accounts on same Git hosting.
You can also find more info in our official documentation at Set up additional SSH keys.
You can also test the BitBucket server to see which account you are logging in with, to do that run:
ssh -v git@bitbucket.org
And lastly if you need to cheack that the Keychain has the right kays, you can see all of them by running:
ssh-add -l
Let us know if this helps!
Best regards,
Ana
Hey Ana, thank you very much for your help :)
The ssh -v git@bitbucket.org command really helps a lot to figure out such problems. (I've also tried <user>@bitbucket.org)
I found out, that the ssh-agent always wants to use my default key (id_rsa) because of this output:
debug1: /Users/andreas/.ssh/config line 34: Applying options for *
This matches the line "Host *" of my ssh config.
I think anyway, SourceTree has some effect to this, here is my generated entry in the ssh config:
# --- SourceTree Generated ---
Host <user>-Bitbucket
HostName bitbucket.org
User <user>
PreferredAuthentications publickey
IdentityFile /Users/andreas/.ssh/<user>-Bitbucket
UseKeychain yes
AddKeysToAgent yes
# ----------------------------
So when does ssh choose exactly this key, located at the "IdentityFile" path.
The command mentioned above uses the key referenced "Host *", not the key of "Host <user>-Bitbucket".
In your link "Different SSH keys ..." I've seen the ssh-add command to add the new key - this works, but I don't want to do this after every restart. :/
So the problem is in the line "Host <user>-Bitbucket" I think, because the output should then be like "Applying options for <user>-Bitbucket".
Btw, my colleague has the same problem since a few days.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.