Authentication Error - "remote: Invalid username or password"

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

This article explains why authentication errors may occur when attempting to push to Bitbucket over HTTP/HTTPS and provides solutions to fix this.

Environment

GIT client attempting to perform HTTP/HTTPS operations against a Bitbucket Cloud remote repository

Diagnosis

When attempting to authenticate to Bitbucket Cloud over HTTP/HTTPS - some variant of an "Invalid Username or password" error is encountered.

Variants of the full error message:

remote: Invalid username or password. Invalid username or password. If your organization manages your account or you’ve enabled two-step verification, create an app password to log in: https://confluence.atlassian.com/x/9DJmMQ
fatal: Authentication failed for 'https://xxxxxx@bitbucket.org/xxxxxxx/xxxxxxx.git/'

OR:

remote: Invalid credentials
fatal: Authentication failed for 'https://xxxxxx@bitbucket.org/xxxxxxx/xxxxxxx.git/'

OR:

Authentication failed
Error creating a repo. Invalid git provider credentials. Ensure that you have entered a correct username with your git provider credentials

This article covers local issues only.  Please check Atlassian Bitbucket Status to verify if there is an ongoing incident. If you are using SSH and want to troubleshoot this, please see: remote: No supported authentication methods left to try!


Cause

Some possible causes for this issue:

  • The incorrect user account is logged into - to verify this please make sure you are using the Bitbucket username which is listed under Bitbucket profile settings on your Bitbucket Personal settings page.
  • The credentials in your git client are not correct or the credential manager is not providing the correct credentials for authentication. 

Solution

Attempt the following steps below before trying to authenticate again:

  1. Reset your app password
  2. Make sure the Bitbucket username is correct - check what is listed under Bitbucket profile settings on your Bitbucket Personal settings page.
  3. Make sure you are not using the App Password label or your email address as the username
  4. Clear stored git credentials on your machine:
    1. Windows: Navigate to Credential Manager and clear stored credentials related to Bitbucket Cloud.
    2. Mac OS X: Navigate to Keychain Access and clear stored credentials related to Bitbucket Cloud.
    3. Linux: See the resolution in: Linux - Clear credentials

Additional Steps if you are using SourceTree: 

  1. Open SourceTree.
  2. On Windows:
    1. On the toolbar click Tools > Options
    2. On the Options window click the Authentication tab
    3. Identify stored credentials to Bitbucket Cloud and remove them. 
  3. On Mac:
    1. Click Sourcetree > Preferences > Accounts 
      1. Shortcut = Command + Comma
    2. On the Accounts tab, remove stored credentials. 
  4. Try authenticating via Sourcetree once again. 


If you are still encountering issues after following the steps contained within this article - please reach out to Atlassian Community or Bitbucket Cloud Support for further assistance.



DescriptionAuthentication Error - "remote: Invalid username or password"
ProductBitbucket Cloud
Last modified on Apr 9, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.