Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Multiple GitHub & BitBucket accounts - multiple SSH keys howto? (MacOSX 10.13)

So problem:

I have multiple accounts (several work/clients, personal) on both BitBucket and GitHub.

I have sorted that mess out using hostnames like client1-github, client2-github, work-github and personal-github in my ~/.ssh/config file, each then points to the correct SSH key (No, you can't use the same SSH key for multiple accounts, and I can't use the same work account on some clients as they want the accounts). I also am a bit stuck in NOT using the HTTPS methods as that involves passwords on the commandline for the repos which I need to avoid

The problem now is that SourceTree doens't pick that up, or write SSH keys so now it displays warnings and can't "connect" to previously connected gitHub/BitBucket accounts.

Is there a way to tell SourceTree
1) Which Key to use/point to for an specific GitHub/BitBucket account?
2) to spefify the SSH/git hostname to be used for GitHub/GitLab/BitBuccket for the SSH connections to be made via ~/.ssh/config?

Seems that SourceTree is very specifically made only for a user(s) that have a single GitHub/Bitbucket account ;(

1 answer

0 votes
Manju Atlassian Team Mar 07, 2019

One way is to generate ssh keys from sourcetree itself to have it write the config with the right keys.

Do I then have to generate these keys on EACH computer I have the multiple accounts and have the plethora of SSH keys then in BitBucket/GitHub/etc?

It still seems to fail when adding the 2nd/3rd/4th SSH key for the next account as it doesn't seem to have a distinction in the ~/.ssh/config as it uses the same git@bitbucket/git@github , just the extra keys, thus it again fails ;(

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events