Bitbucket "remote: Invalid username or password"
Git over HTTPS sent a username and password that Bitbucket Cloud did not accept. Atlassian's knowledge base names two causes: the wrong account or username, and wrong credentials in the Git client or in the credential manager that supplies them (Resolve authentication error - "remote: Invalid username or password" in Bitbucket Cloud). Since app passwords were removed in July 2026, the password has to be an API token.
What it looks like
remote: Invalid username or password. Invalid username or password. fatal: Authentication failed for 'https://<username>@bitbucket.org/<workspace>/<repository>.git/'
Other forms in the knowledge base: a longer first line that suggests creating an app password (no longer possible), remote: Invalid credentials, and "Invalid git provider credentials" from a tool that creates a repository.
For pull requests, too: Pull Request Inbox for Bitbucket, a plugin for JetBrains IDEs, signs in to Bitbucket Cloud with an Atlassian API token or an access token, never a password.
What to send
- Username: your Bitbucket username, exactly as in your Bitbucket profile settings (it is case sensitive), or the static username
x-bitbucket-api-token-auth. Not your email address, and not the API token's name. The username in the remote's address,https://<username>@bitbucket.org/..., is the one Git sends; change it withgit remote set-url origin https://x-bitbucket-api-token-auth@bitbucket.org/<workspace>/<repository>.git(Using API tokens). - Password: an API token with scopes for Bitbucket, read:repository:bitbucket to pull, plus write:repository:bitbucket to push. Your account password has not worked since March 2022 ("stopped supporting account passwords"), and app passwords were removed on July 28, 2026 ("error: 410").
- The REST API is the other way round: it takes your Atlassian account email with the API token, not the Bitbucket username. A username that works for one fails for the other. The REST API then answers
HTTP/2 401withwww-authenticate: Basic realm="Bitbucket.org HTTP", and a token without scopes is refused too (Getting 401 HTTP error when using Basic authentication with Bitbucket Cloud REST APIs). For an access token, see "Token is invalid".
Clear the saved password
If Git does not ask again, a credential helper is sending an old password. Remove its entries for bitbucket.org, as the knowledge base suggests:
- Windows: Credential Manager, Windows Credentials, the entries for bitbucket.org.
- macOS: Keychain Access, the entries for bitbucket.org.
- Linux, or any helper:
printf 'protocol=https\nhost=bitbucket.org\n\n' | git credential rejectasks every configured helper to forget it. - Sourcetree keeps its own: Tools > Options > Authentication on Windows, Sourcetree > Settings > Accounts on a Mac.
Then pull or push again and enter the API token when Git asks for the password. Git for Windows usually stores it with Git Credential Manager.
Or use SSH
An SSH key avoids passwords altogether: set it up for ssh.bitbucket.org. If SSH then answers "Permission denied (publickey)", see which key ssh offered.
Bitbucket pull requests in IntelliJ IDEA
Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the pull requests that wait for your review in an IDE tool window. It signs in to Bitbucket Cloud with an Atlassian API token (your Atlassian email and the token, as the REST API wants) or a repository, project or workspace access token, never a password. The review inbox, diffs, discussions and merge checks are free; creating, approving, commenting and merging are Pro, with a 30-day trial. It also works with Bitbucket Data Center (beta).
Get it on JetBrains Marketplace
Bitbucket and Atlassian are trademarks of Atlassian; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.
More: IntelliJ IDEA asks for the password on every push · "stopped supporting account passwords" · "error: 410" with an app password · Git Credential Manager · "Token is invalid, expired, or not supported" · 日本語