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):
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.***
- 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.
- From Git remote URL using email address:
Update to the latest version of Sourcetree for Windows.
After updating (or confirming you are already on the most updated version of Sourcetree for Windows), on the toolbar, click Tools, then click Options.
On the Options, window click the Authentication tab.
- Next, under Accounts remove your connected Bitbucket Cloud account credentials completely.
- Next, Add your Bitbucket Cloud account back to the connectedAccounts.
- 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
- 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.
- Basicauthentication with HTTPSprotocol
- 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.
- Walkthrough the steps again to add/connect your Bitbucket Cloud account.
- Basicauthentication withSSH protocol
- Follow the steps under the Set up SSH with Sourcetree for Windows section within Sourcetree documentation
https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/
- Follow the steps under the Set up SSH with Sourcetree for Windows section within Sourcetree documentation
- OAuth
- 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
- 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.
- Navigate to C:\Users\<UserName>\AppData\Local\Atlassian\Sourcetree and remove the passwd file.
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, pleaseensure you backup the referenced folders/files below before proceeding.
Backup ALLSourcetreefolders and files (if any) located inC:\Users\<UserName>\AppData\Local
Backup ALLSourcetreefolders and files (if any) located inC:\Users\<UserName>\AppData\Local\Atlassian
Backup ALLSourcetreefolders and files (if any) located inC:\Users\<UserName>\AppData\Roaming\Atlassian
After backing up those folders and files, you can then proceed to uninstall and then reinstall Sourectree.
Uninstall Sourcetree using the Windows Uninstall program.
Only delete the following folders/files after you have backed them up. Delete the folders/files below before proceeding to the next step:
Navigate toC:\Users\<UserName>\AppData\Localand delete allSourcetreefolders and files (if any)
Navigate toC:\Users\<UserName>\AppData\Local\Atlassianand delete allSourcetreefolders and files (if any)
Navigate toC:\Users\<UserName>\AppData\Roaming\Atlassianand deleteall Sourcetreefolders and files (if any)
- Download Sourcetree for Windowsand 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