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

Multiple Github.com accounts with Sourcetree ?

GEORGE L April 23, 2014

Hi I just discovered Sourcetree and it seems way better than my previous app SmartGit. But is it possible to use Sourcetree with multiple Github.comaccounts ? I have 2 Github.comaccounts for different domain/projects that I want to keep separate, but don not see anywhere in Sourcetree that would faciliate and support a 2nd Github.comsetup ?

cheers

7 answers

5 votes
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2014

Just as a note, make sure you don't use usernameless HTTPS URLs, we see people do this time to time. Basically, if you're using HTTPS, make sure the remote URL is in the https://user@host... format and it should be fine.

2 votes
Rafał Nowak
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 28, 2018

Below steps resolved my problems with 'repository not found' errors in SourceTree with multiple accounts (GitHub and BitBucket) on Windows 10.

 

   1. Clear all saved accounts and passwords in SourceTree.

   2. Clear all credentials for git/sourcetree etc. in Credential Manager in Windows.

   3. In Terminal (button in SourceTree) run command:

 git config --system --unset credential.helper

   4. Restart SourceTree.

   5. Add all needed accounts in SourceTree as OAuth

   6. As origin path for all repository always use url with right login i.e.

https://myusername@github.com/example/example.git

   7. Restart SourceTree again.

   8. While first use second account SourceTree may ask for password, it's ok, just type in and confirm.

   9. Problem solved! :)

1 vote
Paul Meems April 6, 2019

It is now April 2019 and I'm using v3.1.2 and this is still a problem.

I've got two GitHub accounts. I've set-up my remote details to use the correct user account:

Remote-details.png

But when pushing SourceTree keeps using the other user account, which has no permission.

This is so frustrating.

I tried all the suggestions but still no luck.

I'm using other Atlassian tools, so I know by now Atlassian will not reply (they never do), hopefully somebody from the community is willing to help or even suggest an other tool.

Carrie S
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 23, 2019

I have this problem too, running 3.2.6.  I even deleted both Github accounts from Sourcetree, and all credentials from Windows Credential Manager.  I can successfully clone the repository from the Github account, but can't push back to the (private) repository.  Sourcetree seems to still be using the credentials from the first Github account I ever linked, which is the wrong one.  I'm wondering if I have to completely wipe and reinstall Sourcetree.

chhatrachhorm
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 9, 2019

I also experience the same issue. This is so frustrating. 

0 votes
fgeg1234 September 15, 2020

version 3.3.9 still have this annoying problem

0 votes
Rahul Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 12, 2019

The following works:

1. Go to Tools > Options > Authentication

2. In the "Accounts" section, select the desired Account out of the multiple accounts and set it as default.

3. In the "Git Saved Passwords" section, check if the credentials are correct and then set it as default as well.

 

That's it! You should not get 'repository not found' 

waro1234
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 4, 2019

No this does NOT work at all. I have done exactly this and it still keeps trying my other account despite me even deleting the entire application.

It is absolutely ridiculous that in 2019 this is still a problem...

Like fgeg1234 likes this
Rahul Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 4, 2019

Which version of source Tree are you using ?

Too bad we don't have a proper solution yet.

The above workaround worked for me. Maybe it just works for the version I have installed. You can double-check the following: Everytime you want to switch account you need to again set it as the default account. Also check that the saved (default) credential also points to this repository.

Hampus Granberg
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 27, 2020

Can confirm that this is happening in 2020 too. What a blast.

Like johnny_n likes this
0 votes
baldwicc
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 3, 2016

Still relevant for the latest version of Sourcetree (2.3.1-r69);

The username in the "Optional extended integration" section isn't used by the underlying git environment, only by Sourcetree.  To be able to push/pull/etc as the correct user for each remote, each remote in your repositories config file must be in the format:

https://username@github.com/username/project.git
Michael W. Steidl
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 31, 2016

The Sourcetree on my Windows computer looks like leaning towards one of the multiple accounts after some time. All remote urls in the config file are set to https://myusername1@github.com/..., I've checked that the password for the username is correct - and Sourcetree still tries to access the repository with myusername2. No clue anymore how to tell Sourctree that it must user myusername1 

This happened already in spring 2016, then I unstalled Sourcetree and installed a newer version and then it worked again - that at least my experience.

Btw: for Windows I can only find version 1.9.6.1

Michael W. Steidl
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 1, 2016

Added experience: the source of the problem is the underlying (SCM) Git for Windows. It uses the Git Crediential Manager for Windows and this tool does not work well with multiple users. How exactly SourceTree interacts with Git and Git with the Credential Manager is clear. I have defined in the SourceTree Repository Settings - Remote Details to use the "other" user but SourceTree/Git sticks to "this" user. No idea how to change that ...

mat forian
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 12, 2017

Same issue with SourceTree 2.3.1 (Windows). Even if I set all my repos to https://username@github.com/.. SourceTree tries to use the repo of the first authentication. Its incredibly flustrating.   

 

Last time I tried to use SourceTree 2 years ago, this feature worked, but at that time they introduced an upgrade on Windows that broke the whole thing. 2 years later, the situation is not much better, the UI still cant be resized at random times, weird bugs etc. I dont recommend it to anyone on Windows - I've heard that the OSX version is better.

mat forian
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 12, 2017

OK, I might have a solution:

1. Click the Terminal button when any of your repos are open. This will open a MINGW terminal - this is used by SourceTree for Git stuff. Here type and run:  

git config --system --unset credential.helper

This will kill the internal password store for this MINGW Git which is configured incorrectly (it only stores 1 user), so SourceTree's native GIT can use the passwords

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2014

GitHub credentials should be definable per remote. I assume your github accounts are separate repositories. Clone one first with the appropriate credentials. The go to the "New Repository" button again and you should be able to enter new URL, user, password, etc.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events