How to store the App Password in GCM
Asked by Ali Elshishini:

The formal doc page suggest to either interactively enter the App password each time  
or store insecurely in the remote url   

<https://support.atlassian.com/bitbucket-cloud/docs/using-app-passwords/>  

Why cant GCM just store the App password, like it store PAT for Azure?


Answers:
author: Patrik S
body: Hello [@Ali Elshishini](/t5/user/viewprofilepage/user-id/391253) ,

Thank you for reaching out to Atlassian Community!

The Git Credential Manager can indeed be used to store your authentication credentials for Bitbucket Cloud. You can install GCM following the instructions of [official GCM installation guide](https://github.com/GitCredentialManager/git-credential-manager/blob/release/docs/install.md) , and it should already configure your git environment to start using GCM as the credential helper to cache your app password.

You can confirm if the credential manager was correctly configured by executing the following command in your system's terminal :

```
git config --get-all  credential.helper
```

We would expect to see the path to GCM executable be listed.

Once GCM is set up, you should be prompted to input your credentials the first time you try to execute a git command. The credentials should then be cached and used in the subsequent git commands without requiring your manual input, as long as the credentials are still valid.

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

Thank you, [@Ali Elshishini](/t5/user/viewprofilepage/user-id/391253) .

Patrik S

comments: author: Ali Elshishini
body: Hi [@Patrik S](/t5/user/viewprofilepage/user-id/4603309)   

Thanks for your reply  
I was expecting the behavior you mentioned  
But I get prompted for the password everytime   

```
git config --get-all  credential.helper
```

returns

```
manager
```

And I can also confirm that while working with Repositories on Azure Devops  
the PAT password is cached, as I only got prompted once , the first time I made a push/pull or a clone   

Its just not working for BitBucket AppPassword   

Note that with PAT on Azure the token is generated automatically, at the prompt I login using my MSA Account for Azure  

For BitBucket, I created an App Password, and used that with my BitBucket login name (which is different from my Atlassian Account)  
Should I login using my Atlassian account, will this auto generate and save an app password?


author: Patrik S
body: Hello [@Ali Elshishini](/t5/user/viewprofilepage/user-id/391253) ,

GCM is compatible with two authentication methods when using Bitbucket cloud :

* **Basic Auth**: where you should input your bitbucket username and app password
* **OAuth** : where a popup window should open for you to log in on bitbucket UI (using your e-mail and **account password**) and grant GCM permission to access your account.

I assume that GCM is giving precedence to OAuth first, and that would explain you being prompted to log in multiple times, as OAuth tokens expire after 2 hours.

In this case, I would suggest trying to force GCM to use just basic authentication by changing the value of git's [credential.bitbucketAuthModes](https://github.com/GitCredentialManager/git-credential-manager/blob/release/docs/configuration.md#credentialbitbucketAuthModes) setting using the following command :

```
git config --global credential.bitbucketAuthModes "basic"
```

Then, once prompted for the credentials, provide your **bitbucket username** and **app password**. Since the app password has no expiration, you should not be prompted for credentials again in the following git commands.

If you run into any issues, let me know!

Thank you, [@Ali Elshishini](/t5/user/viewprofilepage/user-id/391253)

Patrik S


Tags: bitbucket-cloud

cloud