Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!!

With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for security purposes, how to create and use app passwords, and an informative FAQ) a number of Sourcetree for Windows users have brought to our attention an issue they are experiencing. We want to take the time to discuss it and provide a workaround to resolve the issue.

Please note, this issue is specific for Sourcetree for Windows. We have not noticed any similar issues with Sourcetree for Mac.

What is the issue?

Currently, the issue shows when a user goes into their connected Bitbucket Cloud account in Sourcetree for Windows and updates their password to their new app password. After updating the used password to the user’s new app password, Sourcetree verifies that it was able to successfully authenticate the connected Bitbucket Cloud account (as shown below):

Screen Shot 2022-03-03 at 4.11.00 PM.png

However, when users then go to execute Git operations from Sourcetree (i.e. push/pull from their connected Bitbucket Cloud repository) they receive the following error message indicating that they are still using their account password and need to change to using an app password.

Error: remote: Bitbucket Cloud recently stopped supporting account passwords for Git authentication.
remote: See our community post for more details: https://atlassian.community/t5/x/x/ba-p/1948231
remote: App passwords are recommended for most use cases and can be created in your Personal settings:
remote: https://bitbucket.org/account/settings/app-passwords/
fatal: Authentication failed for 'https://bitbucket.org/workspace/repository

Although this issue occurs when switching to an app password, we have determined this issue is not caused by the use of app passwords themselves. Instead, we strongly believe this issue is related to issues with how Windows Git Credential Manager is potentially caching and still using bad credentials (even after users have updated their Bitbucket account password to an app password in Sourcetree for Windows).

What is the fix (or workaround)?

Windows-specific resolution

So, if you are using Sourcetree for Windows and experiencing this issue please take the following steps for resolution.

***Please note, the following steps are for Sourcetree for Windows.***

  1. Authentication with app passwords do not support the use of a user’s email address as the username. Some Git remote URLs in Sourcetree may be using a user’s email address which could cause authentication errors. Please check your Git remote URL for this issue. In the case that the email address is used as the username in the URL, the URL will need to be adjusted like so:
    • From Git remote URL using email address:
      • https://[email@email_domain.com]@bitbucket.org/[workpace]/[repository].git
    • To Git remote URL using Bitbucket Cloud username:
      • https://[bitbucket_cloud_username]@bitbucket.org/[workpace]/[repository].git
    • Next, try and push/pull to the connected Bitbucket Cloud repository. If your issue is resolved, you can skip the following steps.

  2. Update to the latest version of Sourcetree for Windows.

  3. After updating (or confirming you are already on the most updated version of Sourcetree for Windows), on the toolbar, click Tools, then click Options.

  4. On the Options, window click the Authentication tab.

  5. Next, under Accounts remove your connected Bitbucket Cloud account credentials completely.
  6. Next, Add your Bitbucket Cloud account back to the connected Accounts.
    • You can do one of the following three authentication methods to connect to your Bitbucket Cloud account. You can either utilize OAuth using HTTPS, Basic authentication using HTTPS, or Basic authentication using SSH. For the first two, you can still use the HTTPS protocol users experiencing this issue were most likely already using. In that case, you would use your app password instead of your account password
      1. OAuth
        • In the Edit Hosting Account window, select the drop-down for Authentication and select OAuth.

        • Then hit the Refresh Oauth Token button. This will open up a webpage automatically with your browser and ask for your Bitbucket Cloud login details

        • Enter your login details (you will use your account password for this login step). If you were already logged in to your Bitbucket Cloud account then you may not be required to log in again.

        • Finally, click on Authorize Atlassian to authorize Sourectree to access your Bitbucket Cloud account.

        • Make sure the page shows Authentication OK with the green checkmark, then hit OK.
      2. Basic authentication with HTTPS protocol
        • Walkthrough the steps again to add/connect your Bitbucket Cloud account.
          • In the Edit Hosting Account window, select the drop-down for Authentication and select Basic.

          • Ensure your username is correct.

          • Ensure you are using an app password and that it is also correct (ensure there is no copy and paste error when copying the app password over to Sourcetree for Windows).

          • Ensure Preferred Protocol is set to HTTPS.

          • Hit Refresh Password.

          • Make sure the page shows Authentication OK with the green checkmark, then hit OK.

      3. Basic authentication with SSH protocol
  7. Now, try to push and/or pull some code to your Bitbucket Cloud repository from Sourcetree for Windows.
    • If this works, then rejoice in the glory of your skills to fix weird software bugs. You are a God among us.

    • If this does not work you can try one more thing before reinstalling Sourcetree for Windows

      • Navigate to C:\Users\<UserName>\AppData\Local\Atlassian\Sourcetree and remove the passwd file.
        • Please be warned, that after removing this file, Sourcetree for Windows may eventually prompt you for your password(s) again.
      • Next, again try and push and/or pull some code to your Bitbucket Cloud repository. If it works then you can ignore the following steps.
    • However, if the steps above did not resolve the issue (which, unfortunately, is the case for many Sourcetree for Windows users with this issue), then please proceed below to follow the steps for doing a full reinstall of Sourcetree for Windows.

Sourcetree Reinstallation Instructions

Please, that the following reinstall instructions are for Sourcetree for Windows.

***IMPORTANT***: Please note that reinstalling Sourcetree will remove all preferences and settings you may have. So, please ensure you backup the referenced folders/files below before proceeding.

  • Backup ALL Sourcetree folders and files (if any) located in C:\Users\<UserName>\AppData\Local

  • Backup ALL Sourcetree folders and files (if any) located in C:\Users\<UserName>\AppData\Local\Atlassian

  • Backup ALL Sourcetree folders and files (if any) located in C:\Users\<UserName>\AppData\Roaming\Atlassian

After backing up those folders and files, you can then proceed to uninstall and then reinstall Sourectree.

  1. Uninstall Sourcetree using the Windows Uninstall program.

  2. Only delete the following folders/files after you have backed them up. Delete the folders/files below before proceeding to the next step:

    • Navigate to C:\Users\<UserName>\AppData\Local and delete all Sourcetree folders and files (if any)

    • Navigate to C:\Users\<UserName>\AppData\Local\Atlassian and delete all Sourcetree folders and files (if any)

    • Navigate to C:\Users\<UserName>\AppData\Roaming\Atlassian and delete all Sourcetree folders and files (if any)

  3. Download Sourcetree for Windows and install it

If after following all of the recommended steps above and you still are experiencing this issue, please let us know in the comments.

Thank you for your continued support of Sourcetree (and Bitbucket Cloud).

Happy coding,

The Bitbucket Cloud team

 

146 comments

Ryo Takagi March 9, 2022

It didn't solve anything.

Like # people like this
daniel_schielzeth March 9, 2022

Go to c:\users\<your user ID>\AppData\Local\Atlassian\Sourcetree and rename/delete the passwd file (after Steps 1-6).

Like # people like this
bwebchris March 9, 2022

I've tried everything, including reinstalling and I still get the authentication error.

 

EDIT: I figured it out. I had to create an App password in Bitbucket and use that. I didn't see that mentioned.

Like # people like this
Nirmal S March 9, 2022

Can someone please provide an example of step 1 ? For example : What should it look like if I'm using email address "abc@xyz.com" to login. 

Update: Never mind. I figured it out. Thank you

Like David Dansby likes this
mzeraftis March 9, 2022

Ok, that's enough, I give up

I've always had huge authentication problems using both sourcetree and the website, had to reset pwd so many times...

I agree that it must a problem of mine but you should consider to do something simpler.

Goodbye and thanks for all

Like # people like this
James Tatham March 9, 2022

One of the things you forgot to mention in the instructions was that after you backup the SourceTree files and folders (in AppData\Local and Appdata\Roaming), what to do to restore them...  It seems obvious that we would copy the files and folders back - but a complete set of instructions should include that final step.

Like flaviale likes this
Shane Niebergall March 9, 2022

This is beyond frustrating and did not fix the issue. Fix your software instead of having us jump through these hoops. Gonna have to find a different client in the meantime.

Like # people like this
rrodriguez13 March 9, 2022

Tried all the steps above and still not working. 

EDIT: 

got it to work when I followed daniel_schielzeth comment to 

Go to c:\users\<your user ID>\AppData\Local\Atlassian\Sourcetree and rename/delete the passwd file (after Steps 1-6).

Like # people like this
David Dansby
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 9, 2022

@Shane Niebergall sorry for the disruption. Did you try all the steps including reinstalling? If you want to avoid reinstalling, I would suggest trying to use the OAuth authentication method instead? It's typically much easier to use and it should authenticate you by walking you through the Bitbucket Cloud login screens with your account password (instead of an app password).

Like George likes this
Shane Niebergall March 9, 2022

@David Dansby Thanks for responding - I actually just got it to work by following the advice above about deleting the passwd file.

Like # people like this
Matt Ipavec March 9, 2022

Bumping daniel_schielzeth 's comment. Deleting the password file is the only thing that worked for me. 

After file deletion, trying to push/pull/or whatever will prompt you to re-sign in. This is when you use your newly created app password. 

Like # people like this
David Dansby
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 9, 2022

@daniel_schielzeth many thanks. I have updated the post to include your quicker resolution.

Like daniel_schielzeth likes this
David Dansby
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 9, 2022

@Matt Ipavec thank you very much for confirming this workaround fixed the issue for you and clarifying for future users that this is specifically for still using Basic authentication with the HTTPS protocol with an app password

Please let me know if you have any other issues regarding this.

daniel_schielzeth March 9, 2022

@David Dansby Glad I could help :-) I stole the idea from @Mikael Sandberg at https://community.atlassian.com/t5/Bitbucket-questions/Source-Tree-not-working-properly-after-password-reset/qaq-p/1064119 ;-) 
"Windows Git Credential Manager is potentially caching and still using bad credentials" sounded like something needed to be deleted.

Like # people like this
David Dansby
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 9, 2022

@daniel_schielzeth there's no such thing as stealing open source information :)  Thanks again for helping out!!!

Like Mikael Sandberg likes this
Boris Chigirintsev March 9, 2022

Doesn't work. Tried all options

Like # people like this
Noic March 9, 2022

I follow every step in "What is the fix" and "Basic authentication with SSH protocol" for the whole morning.

Then I got this. What should I do?20220310120646.jpg

Edit:

20220311075935.jpg

Fixed, leave a trail:

1. At the end of “Set up SSH with Sourcetree on Windows”, it will tell you “Change the remote URL for your repository to its SSH URL”, you shouldn't follow it.

2. After “Set up SSH with Sourcetree on Windows”, Tools-Authentication-Accounts-Add-SSH-OAuth, click Pageant then Refresh Token. If still doesn't work, hit "set as default".(Wondering why this step is not on the tutorial.) 

 

Lukas Wallner March 9, 2022

You must be joking! How unprofessional is this change to app passwords actually taking our entire staff offline and causing massive damage due to business stand still! Maybe it's time to look for a more reliable alternative to Atlassian!
How do we get Source Tree working again!?

Like # people like this
fanmixco March 10, 2022

The worst part is that I don't think they are paying attention. The second part is that you have crazy issues downloading something new since it asks for your user and password. How do you solve that tricky business?

Like # people like this
Lukas Wallner March 10, 2022

Deleting the passwd file worked for us! :-)
C:\Users\[Username]\AppData\Local\Atlassian\SourceTree\passwd

Like # people like this
fanmixco March 10, 2022

Hi @Lukas Wallner,

I get this for new repos:

Screenshot 2022-03-10 094325.png

And I cannot move forward. I already deleted the suggested file.

The proposed solution doesn't work for cloning new repos.

Like sambit likes this
fanmixco March 10, 2022

Hi @Lukas Wallner,

Thanks, I created it, but when I try to add it, I'm getting this error:

Screenshot 2022-03-10 102159.png

Like Erin Brewer likes this
Lukas Wallner March 10, 2022

I use these settiings and I get an ok at the end ...
Unbenannt.png

fanmixco March 10, 2022

I have the same configuration Lukas, but I still get the popup showing and I cannot store the new app user and password.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events