Sourcetree/Git Invalid credentials
Asked by Stephen Butler:

My Bitbucket account is tied to my corporate google account, I can easily log into Bitbucket \& sourcetree. When I start sourcetree it goes through the authentication and loads the list of my repositories. However, I am unable to clone a repository with sourcetree-\>Git or when using Git independently. The result is the same, "Error: remote: Invalid credentials  
fatal: Authentication failed" I find this odd as the password and username are what I used to access bitbucket in the first place. I have looked at API/App passwords, reset my password on bitbucket, delete the password file, and updated Git with no luck. If anyone has seen this before and knows where I am going wrong I would appreciate any insight.


Answers:
author: Patrik S
body: Hey [@Stephen Butler](/t5/user/viewprofilepage/user-id/5297750) and welcome to the Community!

From the error message you are receiving, I suspect you might be using the wrong credentials for authentication. In Bitbucket Cloud, to authenticate Git operations over HTTPS, you will need to provide the following credentials :

* **Username** : your Bitbucket account username (not email address). You can find the username of your Bitbucket account by navigating to [Personal Bitbucket Settings](https://bitbucket.org/account/settings/) and looking for the field username. You will also be able to change the username from that page if needed.
* **App Password** : a user-based access token. This is different from the account password you use to log in on Bitbucket website. An app password can be created following the instructions of [Create an App Password \| Bitbucket Cloud](https://support.atlassian.com/bitbucket-cloud/docs/create-an-app-password/) documentation.

After confirming your username and creating an app password, you can use the below command in your system's terminal to clone the repository :

```
git clone https://USERNAME:APP_PASSWORD@bitbucket.org/WORKSPACE/REPOSITORY.git
```

Replacing USERNAME and APP_PASSWORD with their corresponding values.

Hope that helps! Let me know in case you have any questions.

Thank you, [@Stephen Butler](/t5/user/viewprofilepage/user-id/5297750) !

Patrik S

comments: author: Stephen Butler
body: I had tried using my app password before but never inline in the Git cmd string. This worked for me. thank you very much for your help.


author: Mary Brocato
body: What are the "Details" associated with this error?

comments: author: Stephen Butler
body: I'm sorry I'm not sure what more details you would like.


author: Mary Brocato
body: Do you see a button labeled as "Details" on the error dialog? If so, I was wondering what the "Details" dialog contained.


author: Fred
body: Error from Cloning:

**Command: git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks ls-remote <https://mycorrectusername@bitbucket.org/mycompanyname/labview-modules.git>**   
**Output:**   
**Error: remote: Invalid credentials**   
**fatal: Authentication failed for '<https://bitbucket.org/mycompanyname/labview-modules.git/>'**

I tried your above procedure, went through as thought all was working fine, but when I go to Remote Clone I still get the above error. I've checked my login name and password. My Edit Host Account returns with Authentication OK.

All this is happening because I had to reinstall SourceTree because company policy update crashed my computer.

What else is causing the issue?


Tags: bitbucket-cloud

cloud