Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to add more than one Github account to sourcetree

Bart-Jan van Hummel May 22, 2021

Lateley I have a lot of problems with having more than one github account in sourcetree. I am using two github accounts (one private one for work) and one Bitbucket account. 

I am using ssh to connect to the accounts. Where Bitbucket is working fine, and depending on which github account I add first, One github account seems to work OK, it will not show the repositories. The other account shows all repositories but is not able to download any because it somehow looks at the account I added first. 

I have tried several things, for fixing this. 
I first started out with a fresh install of sourcetree (mac) and a new set of SSH keys. 
Then adding the accounts but this did not help.

Then I set up a personal access token to one of the github accounts and started to use the basic auth type and not OAuth this did not help either.

I also saw that sourcetree does not allow you to select your own SSH key, and keeps on using the wrong one. I moved the one it found so it could not find it anymore. 
Hoping it would find the correct file, but now it cannot find the other file which is added to GitHub. So I generated a new one in Sourcetree and added it to GitHub. 

This did not work either, cloning a repository from this account still gets confused with the wrong login. 

Errors found are:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ERROR: Repository not found.
fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights
and the repository exists.
origin git@github.com:*/*.git (fetch)   // note this is the wrong account 



I am out of idea's and starting to believe I should not be using sourcetree anymore.
It is at least too much time consuming to be bothered by it every time. 

I hope somebody has a good solution for this, as the interface is easy and helpful

 

 

UPDATE: 
It also seems like it, that Sourcetree is having some sort of cache.
After I added a new ssh file to Github, removing the old one from the config file in the .ssh directory and removing the ssh file from the .ssh directory it still seems to want to add that specific ssh file. 

I removed Sourcetree all together, also removing files that where associated with it. 
After reinstalling, it still seemed to have my account data in there. 
So far for a 'clean' install. 
Thus I followed these steps: https://community.atlassian.com/t5/Sourcetree-questions/How-do-I-fully-remove-SourceTree-so-that-I-can-do-a-quot-fresh/qaq-p/605355

After reinstalling still the same 'wrong' ssh keys where found and used by sourcetree.
The worst part is, that I cannot set my own SSH file. I cannot choose it. Sourcertree just tells me that I need that file (somewhat frustrating). 

So I am trying again, but now with rebooting my computer after removing all files. 

 

4 answers

1 accepted

0 votes
Answer accepted
Bart-Jan van Hummel May 27, 2021

After removing and re-installing several times the problems are still there. 
As it seems nobody has answer it looks like I need to start working with another application. 

0 votes
fbartram June 22, 2021

Hi,

This not an answer as I am also having this problem of trying to add multiple SSH-based BitBucket accounts.

It looks like SourceTree only looks at the default `id_rsa` file pair in `~/.ssh`.

SourceTree doesn't appear to be reading the `~/.ssh/config` file for the `IdentityFile` parameter for the corresponding `Host`.

We need some way to associate the correct id_rsa file pair with the corresponding account.

0 votes
Naresh S V May 27, 2021

Hi,

When you're cloning the projects from two GitHub accounts, you also need to map those accounts in the Sourcetree before cloning the repository. Once you clone the repo from account 1, switch to the another account and then clone from account 2. 

0 votes
Bart-Jan van Hummel May 25, 2021

It also seems like it, that Sourcetree is having some sort of cache.
After I added a new ssh file to Github, removing the old one from the config file in the .ssh directory and removing the ssh file from the .ssh directory it still seems to want to add that specific ssh file. 

I removed Sourcetree all together, also removing files that where associated with it. 
After reinstalling, it still seemed to have my account data in there. 
So far for a 'clean' install. 
Thus I followed these steps: https://community.atlassian.com/t5/Sourcetree-questions/How-do-I-fully-remove-SourceTree-so-that-I-can-do-a-quot-fresh/qaq-p/605355

After reinstalling still the same 'wrong' ssh keys where found and used by sourcetree.
The worst part is, that I cannot set my own SSH file. I cannot choose it. Sourcertree just tells me that I need that file (somewhat frustrating). 

So I am trying again, but now with rebooting my computer after removing all files. 

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events