How can I solve this invalid credentials problem on Bitbucket?

GitBitbucket

Git Problem Overview


My Bitbucket password is correct because I can easily log in with this password. When I try to push a project or file to Bitbucket it shows "Invalid credentials error".

git push -u origin master

fatal: Invalid credentials
Password for 'https://[email protected]':
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/username/demo.git/'

How can I solve this issue?

Git Solutions


Solution 1 - Git

When prompted to log in, use your username, but instead of your usual account password, use the app password:

To get the app password

  1. Go to the bitbucket.org website and log in
  2. From your avatar in the bottom left, and click Personal settings
  3. Click App passwords under Access management
  4. Click Create app password
  5. Give the app password sufficient rights, and a label related to the application that will use the password
  6. Don't forget to save that password

Solution 2 - Git

After 2022-03-01:

> Beginning March 1, 2022, you will no longer be able to use your Atlassian account password when using Basic authentication with the Bitbucket Cloud REST API or Git over HTTPS.

  1. Go to: Personal settings, App passwords
  2. Create app password
  3. Tick the necessary permissions for your needs. Account Read and Repositories Read and Write are needed for basic Git actions.
  4. Save the password. You can not view it again!
  5. Use the generated password to log in. You might need to use your Bitbucket username that you can find on Personal settings, Account settings under "Bitbucket profile settings" (saw a post that told specifically to use the username don't know if it is true).

More information about app passwords is on App passwords.

Solution 3 - Git

After successfully creating the app password as mentioned by Asyraf Arifin:

To use Bitbucket "App Password" over HTTPS, you can then navigate to particular repository's path in Terminal then set the remote origin (for an already-cloned repository):

git remote set-url origin https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<Bitbucket_Username>/<Repo_Name>.git

For a new clone:

git clone https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<Bitbucket_Username>/<Repo_Name>.git

Solution 4 - Git

I had the same problem in my JetBrains IDE. It was showing a password dialog when I tried updated project sources or push my commits.

enter image description here

I solved the problem by following the below steps
  • Open App Passwords page of personal settings on the Bitbucket enter image description here
  • Click on Create app password and tick at least the read and write permissions of the repositories for the basic pull and push actions. Then give some label and submit by Create. enter image description here
  • The generated app password should be passed in IDE enter image description here
Walia! problem solved.

Solution 5 - Git

Well, my answer is just a compilation of the Mikk-Raudsepp and Anish answers. They are the real MVPs:

  1. Go to: Personal settings, App passwords

  2. Create app password

  3. Tick the necessary permissions for your needs.

  4. Copy the generated password

  5. On Terminal

    On an already-cloned project:

     git remote set-url origin https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<username/repoName>.git
    

    To clone a new project:

     git clone https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<username/RepoName>.git
    

Why is it happening? -

> Beginning March 1, 2022, you will no longer be able to use your > Atlassian account password when using Basic authentication with the > Bitbucket Cloud REST API or Git over HTTPS.

Solution 6 - Git

  • Go to Credential ManagerWindows CredentialsAdd a generic credential

  • Fill up the fields:

    • Network address: git:https://bitbucket.org
    • Username:
    • App Password:

It was solved by this question.

Solution 7 - Git

If any Linux user is facing the same issue, please follow the steps given below.

  1. Go to bitbucket.org
  2. Click on the Login link
  3. At the bottom left, click on your avatar icon (your profile picture).
  4. Then click Personal settings or you can open Personal settings, Account settings directly
  5. In the Access Management section, click on the App password link or you can go directly to Personal settings, App passwords
  6. Click on the Create App password button.
  7. Give the access rights as per your requirement.
  8. Click on Create.
  9. You get the pop up with a password. Copy that password somewhere in your laptop or pc (the given password will be difficult to remember).
  10. Now whenever you’re are performing a Git operation, like pull or push and if they asked for password. Instead of using your login password, you need to use the above password (one which is generated by the app password).

Solution 8 - Git

Go to Personal settings from the menu at the top. Click on App passwords and set up the permissions as required as shown below.

Copy the generated password and use it on the authentication prompt. This will resolve the issue.

Enter image description here

Solution 9 - Git

I created an app password, made sure the user is username and not email, updated the app password in Windows' Credential Manager, but adding the app password in the repository path finally resolved my issue:

from:

https://[email protected]/...

to:

https://username:[email protected]/...

Solution 10 - Git

For Mac users:

cd Library/Application\ Support/SourceTree

Delete your username here.

You can log in again.

Solution 11 - Git

If using Android Studio, edit your Git remote URL (via Git/Manage Remotes) by adding the new generated app password

> https://:@bitbucket.org/.git

Solution 12 - Git

If there is still an error after setup:

App passwords

Update settings remote repository path to this:

https://<Bitbucket_Username_not_email>:<App_Password_not_old_password>@bitbucket.org/<Full_Repo_Name_Path>.git

Solution 13 - Git

Try this passwordless login. With this, you will never need to worry about remembering the password again on your machine (don’t use this technique on public computers)

Set up an SSH key

Solution 14 - Git

Try creating ssh key and add ssh key to the bitbucket and try

Solution 15 - Git

git remote set-url origin https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<Repo_Name>.git

It worked for me.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionZahidul IslamView Question on Stackoverflow
Solution 1 - GitAsyraf ArifinView Answer on Stackoverflow
Solution 2 - GitMikk RaudseppView Answer on Stackoverflow
Solution 3 - GitAnishView Answer on Stackoverflow
Solution 4 - GitArtyom VancyanView Answer on Stackoverflow
Solution 5 - GitFe3backView Answer on Stackoverflow
Solution 6 - GitZahidul IslamView Answer on Stackoverflow
Solution 7 - GitAtit MoreView Answer on Stackoverflow
Solution 8 - GitsudinView Answer on Stackoverflow
Solution 9 - GitLivshinView Answer on Stackoverflow
Solution 10 - GitAswin SureshView Answer on Stackoverflow
Solution 11 - GitSnegView Answer on Stackoverflow
Solution 12 - GitAshraf AminView Answer on Stackoverflow
Solution 13 - GitSunil GargView Answer on Stackoverflow
Solution 14 - GitprachiView Answer on Stackoverflow
Solution 15 - GitEkimView Answer on Stackoverflow