Multiple git accounts on SourceTree
Asked by Prasad Chaudhari:

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


Answers:
author: Mike Corsaro
body: 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

comments: author: Gutte
body: The last step is valid only for https connection.

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


author: 1eliton
body: Using credentials on link was deprecated on aug. 2021. See:

<https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls>


author: Joel Walsh
body: I have the same question so I tried [@Mike Corsaro](/t5/user/viewprofilepage/user-id/842547) 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.

comments: author: Joel Walsh
body: ![SourceTree-OptionsAuthPassword.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/83389iE4B8096801E0A840/image-size/large?v=v2&px=999 "SourceTree-OptionsAuthPassword.JPG")


author: Jin_Park
body: I have exactly same problem!  
Any solution yet?


author: Maksim Osipenko
body: The same problem. Any workaround yet?


author: Duy Pham
body: <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

comments: author: Justin Morgan
body: 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!


author: Duy Pham
body: I also have the same problem! Do you have any solution?

comments: author: juliangcorrea
body: 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](https://community.atlassian.com/t5/image/serverpage/image-id/174829i5E2DDBB648633437/image-size/large?v=v2&px=999 "Screenshot at Dec 20 18-40-42.png")


author: cppcrusader
body: 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.