Multiple accounts with Sourcetree ?

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 ?


3 answers

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.

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.

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:

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, 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

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 ...

Same issue with SourceTree 2.3.1 (Windows). Even if I set all my repos to 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.

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

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

269 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot