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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Multiple git accounts on SourceTree

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.
Feb 08, 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

The last step is valid only for https connection.

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

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.

Like # people like this

I have exactly same problem!
Any solution yet?

Like srdpatel likes this

The same problem. Any workaround yet?

Like srdpatel likes this

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

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!

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

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

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