Multiple git accounts on SourceTree

Prasad Chaudhari
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!
February 7, 2018

I have multiple git accounts on SourceTree.

But when I push to a repository on some account, It says default account doesn't have permissions to do so.

Is possible the SourceTree ask the which account to use to push every time i try?

OS: Windows

4 answers

4 votes
Mike Corsaro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 8, 2018

Hello! This issue can be solved by adding your username to the remote repository path:

  • Open the repo
  • Click "Settings"
  • Double click on the "origin" item in the listing
  • Edit the url to add your username before the URL of the repo. Here's an example: "https://USERNAME@contoso.com/repo/blah.git"
  • You should be prompted for a password the next time you try to push or pull
Gutte
Contributor
June 15, 2022

The last step is valid only for https connection.

When using ssh connection, you can edit the "user name" field

1eliton
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!
August 19, 2022
2 votes
Joel Walsh February 17, 2020

I have the same question so I tried @Mike Corsaro suggestion.

adding the username doesn't fix my problem.

Adding the password for one account breaks the auth for the other.

In sourcetree / options / authentication I can see my two accounts are setup correctly. However there is only one password in 'Git saved passwords'. I can delete this password and connect to one of the accounts but this 'breaks' the connection to the other.

It would be great if someone can suggest what I'm doing wrong here.

Joel Walsh February 17, 2020

SourceTree-OptionsAuthPassword.JPG

Like # people like this
Jin_Park
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 4, 2020

I have exactly same problem!
Any solution yet?

Like srdpatel likes this
Maksim Osipenko December 17, 2021

The same problem. Any workaround yet?

Like srdpatel likes this
1 vote
Duy Pham
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 23, 2021

https://fofxacademy.com/how-to-setup-git-on-your-pc-for-multiple-github-accounts/

I've just found a solution:

Two Simple Steps to Configure Git for Multiple GitHub Accounts on Windows
1. Enable Windows Credential Manager

git config --list

git config --global credential.helper wincred

2. Enable WCM for Multiple Credentials

git config --global credential.useHttpPath true

Justin Morgan
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 24, 2022

We have a shared machine that requires individual users to log in under their own accounts and use Sourcetree, and this nearly exactly solved the credential issue that we were having.  For our setup, I had to move the global settings to the system-level config file, since global is still per user account. Thanks for the link!

0 votes
Duy Pham
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 23, 2021

I also have the same problem! Do you have any solution?

juliangcorrea December 20, 2021

I solved it in Advanced menu that can be accessed from the double-arrow on the top right corner of the Preferences screen(shortcut " CMD + , "  on MacOS) ..

In this windows, I changed the username related to the host that I was having auth issues. In my case, the SourceTree was choosing a wrong user...

I hope this help.

Screenshot at Dec 20 18-40-42.png

cppcrusader
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!
August 25, 2022

That option unfortunately doesn't appear to be available on Windows. The most reliable way I've found to not run into this bug is to skip the registration step during install. If I never add my bitbucket account to it in the first place I don't seem to run into this issue, but every time where I install it on a new computer and go through the registration step I end up having to deal with this issue.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events