Recently, I ran into an annoying authentication issue while migrating a Bitbucket repository from an App Password to an API Token.
The migration itself was straightforward, but Git Credential Manager started prompting me for the API token on every git pull, git push, and git fetch.
The Git operation would eventually succeed, but I had to enter the token twice every time.
Here's what happened and how I fixed it.
The original problem
I was using Git Bash on Windows 11 with a Bitbucket Cloud repository accessed over HTTPS.
My remote looked like this:
https://<BITBUCKET_USERNAME>@bitbucket.org/<WORKSPACE>/<REPOSITORY>.git
Previously, I was using a Bitbucket App Password and Git operations worked normally.
After Bitbucket deprecated App Passwords, I created a Bitbucket API Token and replaced the old credential.
The first time I tried:
git pull
I received:
fatal: Invalid credentials
remote: CHANGE-3222 - Functionality has been deprecated
remote: App passwords are deprecated and must be replaced with API tokens.
remote: https://developer.atlassian.com/cloud/bitbucket/changelog#CHANGE-3222
fatal: unable to access 'https://bitbucket.org/<WORKSPACE>/<REPOSITORY>.git': The requested URL returned error: 410
So I created a new API Token with the required repository permissions.
The strange authentication behavior
After configuring the API Token, Git authentication started working, but there was a new problem.
Every Git operation followed this pattern:
- A Bitbucket Login popup appeared.
- My Bitbucket username was already populated.
- I entered the API Token as the password.
- After clicking Continue, another password prompt appeared:
Password for 'https://<BITBUCKET_USERNAME>@bitbucket.org':
- I entered the same API Token again.
- The Git operation succeeded.
So authentication worked, but I had to provide the token twice.
And this happened on every:
git pull
git push
git fetch
My environment
The setup was:
- Windows 11
- Git Bash
- Git for Windows
- Bitbucket Cloud
- HTTPS Git remote
- Git Credential Manager
- Bitbucket API Token
My Git configuration included:
git config --global credential.helper manager
git config --global credential.bitbucketAuthModes basic
I also checked Windows Credential Manager and found Bitbucket credentials there.
Things I tried
1. Clearing Windows Credential Manager
I removed the existing Bitbucket credentials from:
Control Panel → Credential Manager → Windows Credentials
Specifically, I removed the entries associated with:
git:https://bitbucket.org
git:https://<BITBUCKET_USERNAME>@bitbucket.org
I then tried the Git operation again.
The same behavior occurred.
2. Checking Git Credential Manager configuration
I verified:
git config --global --get credential.bitbucketAuthModes
which returned:
basic
I also confirmed that Git Credential Manager was configured:
git config --global --get credential.helper
which returned:
manager
The actual solution
The configuration that finally fixed the problem was:
git config --global credential.bitbucketValidateStoredCredentials false
I then removed the existing Bitbucket credentials from Windows Credential Manager one more time.
After that, I ran:
git pull
and entered:
Username: <BITBUCKET_USERNAME>
Password: <BITBUCKET_API_TOKEN>
The credential was then stored correctly.
Afterward, these commands worked without asking for the token again:
git pull
git push
git fetch
Final configuration
My relevant Git configuration is now:
credential.helper=manager
credential.bitbucketAuthModes=basic
credential.bitbucketValidateStoredCredentials=false
You can check it with:
git config --global --list | grep credential
The important setting is:
git config --global credential.bitbucketValidateStoredCredentials false
Why was this confusing?
The confusing part was that the API Token itself was valid.
The Git operation eventually succeeded when I entered the token in the second prompt.
So this wasn't a simple case of:
"The API token is invalid."
The problem was related to how Git Credential Manager was validating/storing the Bitbucket credential.
Git Credential Manager's Bitbucket authentication flow can validate stored credentials against Bitbucket. In this case, that validation behavior was causing the credential to be requested again even though the token was valid for the Git operation.
Disabling stored credential validation allowed Git Credential Manager to use the stored credential directly.
Final takeaway
The migration from Bitbucket App Passwords to API Tokens worked, but Git Credential Manager was repeatedly asking for credentials even though the API Token was valid.
The configuration that resolved the problem for me was:
git config --global credential.bitbucketValidateStoredCredentials false
Combined with:
git config --global credential.helper manager
git config --global credential.bitbucketAuthModes basic
After clearing the old Bitbucket credentials from Windows Credential Manager, Git was finally able to reuse the stored credential.
No more repeated API Token prompts. 🎉
Note: This is a workaround that resolved the issue in my environment. It should not be interpreted as an official recommendation from Atlassian to disable credential validation.
References
- Bitbucket API Tokens documentation: https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens/
- Git Credential Manager Bitbucket authentication: https://github.com/git-ecosystem/git-credential-manager/blob/main/docs/bitbucket-authentication.md
- Bitbucket App Password deprecation: https://developer.atlassian.com/cloud/bitbucket/changelog/











