Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Having trouble switching to API tokens

Paul James
March 30, 2026

We've recently received an email that App Passwords will be going away. We currently make use of them.

I created an API token following the documentation and tried to use it to clone a repository using the same command we normally use with the existing app password and it failed. I then tried creating an API token with scopes giving it every scope for bitbucket and that also failed.

The command we used to use with the app password was:

git clone -b <branch> https://<username>:<app password>@bitbucket.org/<project details>.git

I tried the exact same command with the API token simply replacing the app password with the new API token (which as far as I could make out from the documentation is the correct way to do it).

The error received was as follows:

remote: You may not have access to this repository or it no longer exists in this workspace. If you think this repository exists and you have access, make sure you are authenticated.
fatal: Authentication failed for 'https://bitbucket.org/<project details>'

I suspect its something obvious I'm doing but due to lack of simple documentation I can't work out what we are doing wrong.

1 answer

0 votes
Arkadiusz Wroblewski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 30, 2026

Hello @Paul James 

Hello Paul,

I think the main thing here is that for Git clone/fetch/pull, Bitbucket’s API token docs do not use the same pattern as some of the more general token examples.

For Git, I would try either your Bitbucket username or the fixed username x-bitbucket-api-token-auth together with the API token. The token also needs at least repository read permission.

https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens/

https://support.atlassian.com/bitbucket-cloud/docs/api-token-permissions/

So please test one of these Formats:

git clone https://<bitbucket_username>:<api_token>@bitbucket.org/<workspace>/<repo>.git

git clone https://x-bitbucket-api-token-auth:<api_token>@bitbucket.org/<workspace>/<repo>.git

If that still fails, I would next check whether the token is scoped to the correct workspace.

FYI: app passwords still work for now and are planned to stop working on June 9, 2026, so you still have a bit of time to test the migration properly.

https://www.atlassian.com/blog/bitbucket/bitbucket-cloud-transitions-to-api-tokens-enhancing-security-with-app-password-deprecation

 

Paul James
March 30, 2026

The tests I have done so far have been using the first example (though admittedly with the -b flag being passed to clone as well - I just tried without that and get the same error.

I tried both a simple API Token and an API token created with scopes where every bitbucket scope was ticked and neither worked.

I have just tried with the x-bitbucket syntax and the same token has worked so it just looks like the username:token syntax has an issue.

Arkadiusz Wroblewski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 30, 2026

@Paul James Ye that seems legit.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events