App password SourceTree
Asked by Luciano Allegro:

Hi I followed all steps to create an app password from the personal settings page. However when trying to load that password into sourcetree I get an authentication failed "You don't have permissions to acces URL '<https://api.bitbucket.org/2.0/user>'. The request returned with the status code 'Unauthorized'

It seems sourcetree is not able to connect the endpoint to check if the app password exists. I tried already updating to the latest stable release but without success.

Does anyone have the same issue?


Answers:
author: yeisson72
body: Mr Allegro,

I have the same problem, today I tried to pull and push new commits but the system all the time said me:

Command: git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks ls-remote [https://yeissonh@bitbucket.org/\*\*\*\*\*\*\*\*\*\*\*\*\*\*](https://yeissonh@bitbucket.org/**************)  
Output:  
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/\*\*\*\*\*\*\*\*\*](https://bitbucket.org/*********)

I try to delete the files and recreate the repository but nothing worked.

comments: author: David Dansby
body: [@yeisson72](/t5/user/viewprofilepage/user-id/1872613) I don't believe your issue is the same as Allegro's, as they would be receiving the same error message as you if that was the case, and it does not appear that they are.  

However, I'm curious, are you using Sourcetree on Windows or Mac? Also, did you go to your Sourcetree settings, navigate to the Bitbucket Cloud account that Sourcetree uses, and change the password to your new app password?


author: yeisson72
body: Hi!

I'm using Sourcetree on Windows. And yes I changed the password for a new. but it didn't work.


author: David Shapira
body: I have the exact same error any help is really welcome


author: yeisson72
body: Hi!

I resolved in this form:

I created SSH Key, I used this article:

[Set up an SSH key \| Bitbucket Cloud \| Atlassian Support](https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/)

And clone one more time

regards,


author: David Dansby
body: yes [@yeisson72](/t5/user/viewprofilepage/user-id/1872613) SSH should work as expected given this change had no impact on SSH authentication. However, some of our users prefer to use HTTPS authentication for various reasons.

You stated that you changed your password for a new one. Can you please confirm that you changed this "new password" to an app password which is different from an account password. Details: <https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/>

Some Windows Sourcetree users have noted that even after updating their connected account's password to an app password in Sourcetree they still get the same error message. This could be related to various things but it could be the case that Sourcetree is still using some older configs that are still using their old account password to authenticate with Bitbucket Cloud when pushing/pulling/etc. Some of our users have noted that they fixed the issue by doing the following:

**Note, the following steps are for Sourcetree for Windows.**

1. Update to the latest version of **Sourcetree for Windows**
2. After updating (or confirming you are already on the most updated version of Sourcetree), on the tool bar click "Tools" \>\> click "Options"
3. On the "Options" window click the "Authentication" tab
4. Remove your Bitbucket Cloud account credentials
5. Walkthrough the steps again to add/connect your Bitbucket Cloud account.
   1. Ensure your username is correct
   2. Ensure you are using an app password and that it is also correct (ensure there are no copy and paste errors when copying the app password over to Sourcetree).

Please let me know if any of these suggestions help.

*If, after you have tried all of these suggestions then I would suggest you reinstall Sourcetree by doing the following:*

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

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

* **Backup/save ALL***Sourcetree* \& *Sourcetree-Settings* folder/files in C:\\Users\\\<UserName\>\\AppData\\Local
* **Backup/save ALL***Sourcetree* Files/Folders in C:\\Users\\\<UserName\>\\AppData\\Local\\Atlassian

After backing up those directories/files, you can proceed to uninstall and then reinstall Sourectree

1. Uninstall Sourcetree (if it shows on the App\&Features list)
2. **Only delete the following folders/files after you have backed them up.** Delete the directories below before proceeding to the next step
   * Navigate to C:\\Users\\\<UserName\>\\AppData\\Local and delete *Sourcetree* \& *Sourcetree-Settings* folders
   * Navigate to C:\\Users\\\<UserName\>\\AppData\\Local\\Atlassian and delete all *Sourcetree* Files/Folders.
3. [Download SourceTree](https://www.sourcetreeapp.com/) and install it.


author: David Shapira
body: Reinstalling Souretree worked for me


author: David Dansby
body: [@David Shapira](/t5/user/viewprofilepage/user-id/4218156) that is great to know. Thank you for patience in my assistance on resolving this issue. Also, thank you for taking the time to follow all the steps up through reinstalling in order to get a resolution. I personally know how annoying it is to reinstall software to get a fix, so I really appreciate your taking the time to do that.

Please let us know if you have any other issues related to this.

Also, to clarify just in case someone else comes to this page, from my knowledge (I don't work on Sourcetree just Bitbucket Cloud), this issue does not appear to be caused by app passwords. It appears to be caused by some issue with the Git credential manager that Windows uses, and in turn what Sourcetree uses. I guess it's cached the old credentials somewhere and is still using them, even though you have correctly updated to an app password and Sourcetree shows your Authentication is good after updating to app password.


author: hogtownrocketsled
body: Reinstalling worked for me  
THANK YOU


author: David Dansby
body: [@hogtownrocketsled](/t5/user/viewprofilepage/user-id/4738121) great to hear. As I told David, thank you for your patience in dealing with this weird Sourcetree for Windows issue and taking the time to walk through the steps (including reinstalling) to get it resolved.


author: Paoloimg
body: I've followed steps 1 to 5 as mentioned by [@David Dansby](/t5/user/viewprofilepage/user-id/3197218) with no success on Windows. As soon as the basic authentication has been deprecated my pushes (i.e.: every time I push my commits) started to require an authentication by showing me a window requesting userid and password. No matter what I type in the window, it always resulted in authentication error.  
**I eventually reinstalled Sourcetree, then it finally started working.** This seems to be the only working option.  
I've noticed that, with the new Sourcetree installation, the bitbucket Account added by the installation wizard in the Tools/Options/Authentication panel is now using OAuth instead of Basic Authentication. Changing back to Basic Authentication and providing the App Password configured online under my Personal Settings, is now perfectly working.


author: yeisson72
body: [@David Dansby](/t5/user/viewprofilepage/user-id/3197218)

Thanks

I deleted all and installed one more time. Finally all worked.

Regards,


author: Pawel Cioch
body: Also update your credential manager, it integrates better with Atlassian   
<https://github.com/GitCredentialManager/git-credential-manager/releases>


author: Jay Wolberg
body: I also can not commit from Sourcetree to bitbucket after the App password change.

I have created the App password on Bitbucket.

<br />

On sourcetree repo settings I am using the same path as before

[https://jmwolberg@bitbucket.org/jmwolberg/XXXXXXXXXX.git](https://hogtownrocketsled@bitbucket.org/hogtownrocketsled/XXXX.git)

I deleted all previous authentication and only have the one one for an App Password:

<br />

SourceTree Tool Options Authentication Accounts: jmwolberg@bitbucket.org  
Host: bitbucket.org  
Default account: Yes  

Hosting Service: Bitbucket  
Auth: Basic  
Username: jmwolberg  
I have refreshed with my App Password   
I have a green checked Authentication OK!  

When I go to commit, error is:

fatal: Authentication failed for '<https://jmwolberg@bitbucket.org/jmwolberg/xxxxxxx.git/>'  
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/>  


author: Luciano Allegro
body: [@David Dansby](/t5/user/viewprofilepage/user-id/3197218) thanks for your reply. I tried several times with all perms and reduced ones. However it seems more of a sourcetree problem as it seems it cannot connect to the endpoint to validate any type of basic user account. I am using sourcetree for windows without any special config or network arrangement that could block these requests.

comments: author: David Dansby
body: [@Luciano Allegro](/t5/user/viewprofilepage/user-id/4783845) just so I verify. You are not receiving the same error as [@yeisson72](/t5/user/viewprofilepage/user-id/1872613) is, right? Even when you update your app password you are not seeing Sourcetree telling you Authentication is ok but then you still receive the error messaging saying you can't use an account password and to check our community post like the below?

"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:"

If that is the case then there could be a host of reasons why this is could be happening. If you have not tried it yet I would try the following:

1. Update to the latest version of Sourcetree
2. After updating (or confirming you are already on the most updated version of Sourcetree), on the tool bar click "Tools" \>\> click "Options"
3. On the "Options" window click the "Authentication" tab
4. Remove your Bitbucket Cloud account credentials
5. Walkthrough the steps again to add/connect your Bitbucket Cloud account.
   1. Ensure your username is correct
   2. Ensure you are using an app password and that it is also correct too.

The fact that you state that you see the error "You don't have permissions to access URL '[https://api.bitbucket.org/2.0/user"](https://api.bitbucket.org/2.0/user) suggests that the app password you updated to in Sourcetree was wrong so it could also be related to a copy and paste error or something similar when you were copying the new app password over to Sourcetree.

Please let me know if any of these suggestions help.

*If, after you have tried all of these suggestions then I would suggest you reinstall Sourcetree by doing the following:*

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

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

* **Backup/save ALL***Sourcetree* \& *Sourcetree-Settings* folder/files in C:\\Users\\\<UserName\>\\AppData\\Local
* **Backup/save ALL***Sourcetree* Files/Folders in C:\\Users\\\<UserName\>\\AppData\\Local\\Atlassian

After backing up those directories/files, you can proceed to uninstall and then reinstall Sourectree

1. Uninstall Sourcetree (if it shows on the App\&Features list)
2. **Only delete the following folders/files after you have backed them up.** Delete the directories below before proceeding to the next step
   * Navigate to C:\\Users\\\<UserName\>\\AppData\\Local and delete *Sourcetree* \& *Sourcetree-Settings* folders
   * Navigate to C:\\Users\\\<UserName\>\\AppData\\Local\\Atlassian and delete all *Sourcetree* Files/Folders.
3. [Download SourceTree](https://www.sourcetreeapp.com/) and install it.


author: hogtownrocketsled
body: I've got the same problem and have gone through all the steps above and still no joy.  
Before I go deleting and reinstalling, does anyone know it that is really going to work?  
thx


author: David Dansby
body: [@hogtownrocketsled](/t5/user/viewprofilepage/user-id/4738121) can you please tell me what your git remotes URL state as. I forgot to mention that app app passwords don't allow email as a username and sometimes git remote URLs include the username as the email instead of your Bitbucket Cloud username.

One user with a similar issue resolved it with

<br />

If your git remote URL is in the format:

```
https://[email@email_domain.com]@bitbucket.org/[workspace]/[repository].git
```

can you please edit to switch the email address to your Bitbucket Cloud username so the remote URL should be changed to look like:

```
https://[bitbucket_cloud_username]@bitbucket.org/[workspace]/[repository].git
```

Please sure you added your app password and Sourctree shows "Authentication: OK" for your connected Bitbucket Cloud account


author: David Dansby
body: [@David Shapira](/t5/user/viewprofilepage/user-id/4218156) [@yeisson72](/t5/user/viewprofilepage/user-id/1872613) [@Luciano Allegro](/t5/user/viewprofilepage/user-id/4783845) please see my comment above about ensuring your git remote URL uses your Bitbucket Cloud username and **NOT your email**that is tied to your Bitbucket Cloud account.


author: yeisson72
body: Hi

Yes, I used my username. And I use "App passwords" too.

regards,


author: hogtownrocketsled
body: On bitbucket, bitbucket profile settings, user name: hogtownrocketsled  

On sourcetree, repo, repo settings, remotes/origin   
I have confirmed the path is as:

<https://hogtownrocketsled@bitbucket.org/hogtownrocketsled/XXXX.git>  
Remote Account; Bitbucket hogtownrocketsled   

SourceTree Tool Options Authentication Accounts: hogtownrocketsled@bitbucket.org  
Host: bitbucket.org  
Default account: Yes  

Hosting Service: Bitbucket  
Auth: Basic  
Username: hogtownrocketsled  
I have refreshed with my App Password   
I have a green checked Authentication OK   

Still no joy   

<br />

<br />

<br />

<br />

<br />


author: David Dansby
body: [@hogtownrocketsled](/t5/user/viewprofilepage/user-id/4738121) and [@yeisson72](/t5/user/viewprofilepage/user-id/1872613) and [@Jay Wolberg](/t5/user/viewprofilepage/user-id/4786884) given you all three are still experiencing this issue. I would advise reinstalling Sourectree according to the instructions I have stated above.

Another Sourcetree for Windows user noted to me in our [community post](https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231) that this was the only way they got their Sourcetree to fix the issue. Please let me know after you have reinstalled Sourcetree for Windows if the issue is resolved for you.


author: Jay Wolberg
body: EDIT: Now working after trying again and deleting all Atlassian \& SourceTree folder files.

===

Uninstalled v3.4.5

Delete Atlassian \& SourceTree folder files.

reinstalled (v3.4.7).

Then recreated new app pw and added new app pw.

User and app pw authenticates successfully.

Push successfull


author: Luciano Allegro
body: Hi [@David Dansby](/t5/user/viewprofilepage/user-id/3197218) I appreciate your dedication to help. I did check on all your steps and I was using my username in the URL of the bitbucket cloud repository. I couldn't find any workarround to the issue other than using another Git tool by now. I still have to re-install sourcetree which I will hopefully do as soon as I have some free time.


author: David Dansby
body: [@Jay Wolberg](/t5/user/viewprofilepage/user-id/4786884) that is good to know.   

[@Luciano Allegro](/t5/user/viewprofilepage/user-id/4783845) I've been told that credential managers in windows have been big problems for Sourcetree in the past. I don't know if it's specifically related, but I imagine it is so. Unfortunately, right now, it appears the only way to resolve this issue is with a full reinstall using the steps I have noted in my previous comments above. As Jay noted above, that was the only thing that worked for him. Please let me know if after reinstalling using the steps above your issue has been resolved.

For context, this issue is not caused by the removal of account passwords for app passwords in Bitbucket Cloud, but is a Sourcetree for Windows and/or Windows Git Credential Manager issue.

However, I want to personally apologize for this issue. Although I don't work on Sourcetree, I know how annoying these types of issues are when the application says one thing (i.e. Authentication: OK) but then acts differently (i.e. can't push/pull and the error says you are still using an account password). This is why I've been trying hard to get a resolution for you all and our other Sourcetree for Windows users experiencing this, especially because so many Sourcetree users are valued Bitbucket Cloud (which I do work on :D) users.  

I hope this works for you [@Luciano Allegro](/t5/user/viewprofilepage/user-id/4783845) , let me know.

Best,

David


author: David Dansby
body: [@Luciano Allegro](/t5/user/viewprofilepage/user-id/4783845) what perm scopes did you select for the app password you created?  


Tags: password