Hello,
I am dealing with a very frustrating Bitbucket authentication issue and have been trying to resolve it for several hours.
Repository:
https://bitbucket.org/greenunion/greenshop.git
I am the only developer working on this project and have access to the repository.
The strange part is that git push works perfectly:
To https://bitbucket.org/greenunion/greenshop.git
af8ef92..7b8d3c8 dev -> dev
However, git pull consistently fails with:
remote: You may not have access to this repository or it no longer exists in this workspace.
If you think the repository exists and you have access, make sure you are authenticated.
fatal: Authentication failed for 'https://bitbucket.org/greenunion/greenshop.git/'
Initially, Git redirected me to an OAuth callback:
http://localhost:34106/?code=...
After that, I received:
fatal: Unknown OAuth error
along with an AWS WAF Human Verification / CAPTCHA page.
I checked my configuration:
git config --show-origin --get-all credential.bitbucketAuthModes
file:C:/Users/User/.gitconfig basic
Git Credential Manager:
Git Credential Manager 2.7.3
Remote:
origin https://greenunion-admin@bitbucket.org/greenunion/greenshop.git
I also cleared the stored Bitbucket credentials and authenticated again through the Atlassian login window using:
Username: greenunion-admin
Password or token: API token
But the result is still:
Authentication failed
Both commands fail:
git pull
git fetch origin
while:
git push
works successfully.
So my question is:
Why would Bitbucket accept git push to the same repository but reject git pull / git fetch over HTTPS?
This is likely an authentication-method/token-scope issue rather than a repository-access issue.
git pull fails during git fetch, which Bitbucket authorises as a read operation. git push is authorised separately as a write operation. If the exact same HTTPS credential were being used for both, push succeeding while fetch fails would be unusual, so Git Credential Manager is probably using a different cached credential or OAuth path for fetch.
The Unknown OAuth error plus the AWS WAF/CAPTCHA page is the key clue: GCM is attempting OAuth, but Bitbucket’s WAF is returning an HTML verification page instead of the OAuth response GCM expects.
I would force GCM to use Basic authentication with a fresh Bitbucket API token, remove all existing Bitbucket entries from Windows Credential Manager, and ensure the token includes both repository read and write scopes:
git config --global --unset-all credential.bitbucketAuthModes
git config --global credential.bitbucketAuthModes basic
git config --global credential.useHttpPath true
git remote set-url origin https://x-bitbucket-api-token-auth@bitbucket.org/greenunion/greenshop.git
Then run:
git ls-remote origin HEAD
git fetch origin
When prompted, use x-bitbucket-api-token-auth as the username and the newly created API token as the password. The token should include read:user, read:workspace, read:repository, and write:repository Bitbucket scopes.
If OAuth/CAPTCHA still appears after setting credential.bitbucketAuthModes=basic, check for multiple credential helpers with:
git config --show-origin --get-all credential.helper
Alternatively, switching the remote to SSH avoids the HTTPS OAuth/WAF flow completely.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.