Unable to put in correct credentials in Git
Asked by Kit:

Good Evening,

Yesterday was the first day in a few months that I used git to upload a new project into a new Bitbucket repository. When I got the Atlassian prompt to enter my credentials, I put the correct email address in, but I forgot that I had to use an App Password instead of my Bitbucket web account, so I got the remote: Invalid credentials, followed by fatal: Authentication failed for...my Bitbucket repo. I can't find any way of getting that prompt back so that I can enter my correct App Password. I've been working on this since this time last night, and have searched the questions on here, as well as general web search and can't find an answer.

I've tried creating new repos, creating new projects to try and upload, and I keep getting stuck with the same Invalid credentials error.

My OS is Kubuntu 24.04, and I am using Git version 2.43.0. I'm not using any kind of password manager, SourceTree, etc. I just use plain Git...however it caches this password information. Other than the initial Atlassian login prompt, I do all of my pulls, pushes, merges, etc. in the Linux command line. Despite everything that I could find online about clearing out the saved incorrect password, I still can't get the Atlassian login prompt back.

I would greatly appreciate any help that could be provided.

Thanks for your time and consideration.


Answers:
author: Theodora Boudale
body: Hi Kit and welcome to the community!

You are right that you need to use an app password instead of a password when you clone, pull, or push to a repo via HTTPS.

If you do not get prompted for a password again, Git may be configured to use a credential helper.

If you run the following command on a terminal on your machine:

```
git config --list
```

Are there any lines in the output that start with **credential.helper**? If so, what are the values assigned to these?

If you prefer to use SSH instead and you have set up SSH keys, you'll need use the SSH URL of a repo to clone it. This has the format

```
git@bitbucket.org:workspace-id/repo-slug.git
```

so you'll need to do

```
git clone git@bitbucket.org:workspace-id/repo-slug.git
```

where **workspace-id** and **repo-slug** replace with the values for your repo.

If you have an existing clone whose remote is an HTTPS URL, you'll need to change it to the SSH URL:

**1.** Navigate to the directory of the existing clone from a terminal application

**2.** Run the command

```
git remote -v
```

If the output looks like the following:

```
origin https://username@bitbucket.org/workspace-id/repo.git (fetch)
origin https://username@bitbucket.org/workspace-id/repo.git (push)
```

This shows that the clone is using an HTTPS remote URL.

**3.** You can change it to the SSH one with the command:

```
git remote set-url origin git@bitbucket.org:workspace-id/repo-slug.git
```

Please feel free to reach out if you have any questions!

Kind regards,  
Theodora

comments: author: Kit
body: Hi Theodora,

Thanks for the response! I wasn't using any type of credential manager with git.

I have, however figured out what was going on, and got my git communicating with my repos again.

For anyone else that may run into this same head-scratcher of a problem, here is what I found: My credentials were not stored in git, or any type of credential manager associated with it. What turned out to be the case was that my credentials were stored in my system's "wallet". Since I am running Kubuntu (Ubuntu with the KDE Plasma desktop), the git credentials got stored in the KDEWallet. I changed the wrong password entry and then entered my app password, and I am now back up and running! I never in a million years would have thought that they got stored in there, I was even looking in Firefox and Chrome's password storage (I never save anything in those), and of course nothing was in there.

I dare say that this would have even stumped Sherlock Holmes :-)

Thank you so much to Theodora and Aron for your suggestions - they got me thinking outside of the box I was in.

All the best!

Kit


author: Theodora Boudale
body: Hi Kit,

It's good to hear that you figured this out, and thank you for sharing the solution!

Please feel free to reach out if you ever need anything else!

Kind regards,  
Theodora


author: Aron Gombas _Midori_
body: [@Kit](/t5/user/viewprofilepage/user-id/5593930) As an alternative, I would suggest that you try using the [SSH protocol with Bitbucket and Git](https://support.atlassian.com/bitbucket-cloud/docs/configure-ssh-and-two-step-verification/).

It requires a little work to set it up once, but then the experience is very smooth and it is probably "more secure" than password based authentication.

comments: author: Kit
body: Thanks for the suggestion Aron.

I got everything setup properly following the instructions from here: <https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-linux/>  
I tested as indicated at the end of the instructions, and the SSH connection test worked. However, whenever I then try to do a git push/pull, etc. I still get the remote: Invalid credentials error. I'm not sure how to get rid of those old invalid credentials.

I'll keep digging and see if I am missing something somewhere.  
Thanks again for the suggestion, I'm sure it will work great as soon as I can get rid of the old credentials.


Tags: bitbucket-cloud

cloud

git