I have 2 bitbucket accounts. I only recently added the second to sourcetree, and it now nags me to re-enter my credentials at every opportunity (extra note: doesn't tell me which set of credentials to enter). I tried setting the accounts to use oAuth instead, but it still nags me for credentials. I also have my SSH key set up for one of the accounts (it won't let me use it for both for some silly reason), added in both my bitbucket profile and pageant, but I assume it's not using it (maybe i need to change the origin on my local repos?) as it's still nagging me for credentials.
Make sure you are using remote URLs that include your username, e.g.
the Git Credential Manager (GCM) stores credentials keyed on the hostname, e.g. https://email@example.com, if you have no username it will store the credentials for both accounts under the same key, e.g. https://bitbucket.org,.
So 50% of the time it will get the wrong creds and delete them. So you have to re-enter.
Using the username in the URL means they are keyed uniquely and should be found correctly.
Hi, thanks for the response.
All origin URLs of my various cloned repos have the relevant username in them, SourceTree looks to have done this automatically already.
There's also no option to change the "Host URL" for Bitbucket in my account settings to include a username, it's greyed out. I tried changing the "Hosting Service" to "Bitbucket Server", as that's the only option that lets me edit the URL, but it returns a 404 once I put the URL in with my username, so I'm guessing that's for something different.
I've found that using SSH keys for both repos, and switching which key is loaded in Pageant when I want to use a repo on the other account stops the nagging at least. I tried loading both keys into Pageant at the same time, but the "top" one is just used for both accounts regardless. I also tried importing the same key to both SourceTree accounts in the web interface, but it refused to let me add it to the second account as I'd already added it to the first. If either one of those things had worked I'd call this resolved, but I'm still having to swap out keys in Pageant whenever I switch repo which is less than ideal.
Check what entries you have in the Windows Credential Manager?
If you have 2 Bitbucket accounts that you are using via https remote urls I would expect you to see 2 entries of the format
Git should the pick the one that matches the remote url of the repository it is working on.
Do you see the relevant entries?
Wow, I didn't even know Credentials Manager existed!
Ok, here's the results of some experimentation. There were the following 3 entries in there when I started:
I then removed all my repos from SourceTree, removed both my accounts, and this time additionally removed all the entries from Credentials Manager, so I was completely "clean".
Next, I added account 1 to SourceTree, and saw git:https://firstname.lastname@example.org appear in Credentials Manager. I then added account 2 and saw git:https://email@example.com appear. All good so far.
Then I went to clone a repo from account 1 and got 2 popups asking for credentials (one immediately after the other, while it was checking the git repo). If I enter my account 1 credentials into both, git:https://bitbucket.org also appears alongside the other 2 accounts. If I cancel either popup, it removes git:https://firstname.lastname@example.org as well as adding git:https://bitbucket.org. If I cancel both popups, it removes git:https://email@example.com but doesn't add git:https://bitbucket.org.
I then cloned the repo from account 1, which didn't affect the stored credentials.
Then I went to clone a repo from account 2 and got the same 2 popups, however this time as the popups first appeared they also cleared both git:https://firstname.lastname@example.org and git:https://bitbucket.org from Credentials manager. Previously with account 1, nothing was altered until I'd interacted with a popup. This time, even if I enter my account 2 credentials into both, only git:https://bitbucket.org gets put back.
I then did a pull on the repo for account 2, it worked fine and didn't prompt me for anything. I did the same on account 1, it immediately removed ALL the stored "git:" credentials, gave me 1 popup, which I filled in and it put just git:https://bitbucket.org back. At this point, it's completely removed both my named URLs, and is just prompting me to change the credentials stored in git:https://bitbucket.org whenever I "switch", or at its own intervals, presumably whenever it decides to do a "fetch" on the account not currently stored.
Also maybe of note, when I first added both accounts, it also added the same URLs but with "hg:" and "sourcetree-rest-bitbucket:" at the start instead of "git:" (so added 6 entries in total, 3 for each account). These then did not get altered throughout my experimentation, but upon removing them within SourceTree's saved passwords after removing both accounts, it would only show 2 passwords at a time while I remove the "git:" and "hg:", and then completely failed to remove either of the "sourcetree-rest-bitbucket:" ones, so I had to remove them from Credentials Manager myself.
This looks like some seriously buggy behaviour.
Sorry GCM I the Git Credential Manager its an extension that ships with Git for Windows and manages the authentication.
Please upgrade your Git installation to v2.15+.
You can do this in Sourcetree by using the update embedded git option in the Tools/Options/Git tab.
Or you can install git from git-scm.org (2.16+) and switch to using System Git in Tools/Options/Git tab
A vulnerability has been published today in regards to Sourcetree for Windows. The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event