Forums

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

Git Access with API Token

Matthew Soh July 1, 2025

My App Password works for Git when I have the URL in the form

    git clone https://{username}:{app_password}/....

Now that we need to transition to API Tokens, I created one (didn't specify the scope) and tried to use it using all the methods documented and I always get an authentication error. 

    git clone https://{username}:{token}/....

    git clone https://x-bitbucket-api-token-auth:{token}/....

    git clone https://x-token-auth:{token}/....

    git clone -c http.extraHeader='Authorization: Bearer ...'

I made sure to URL encode the token, still it is failing to authenticate. 

Is this even working at this time? 

Thanks
    Matt

 

1 answer

1 accepted

1 vote
Answer accepted
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 3, 2025

Hi @Matthew Soh 

You'll need to create the API token and specify the scope - this is mentioned in our deprecation documentation:

  1. Click the gear cog icon, select 

    Atlassian Account settings > Security tab > Create and manage API Tokens

  2. Click Create API token with scopes
  3. If you want to be able to push/pull to the repository - you'll need to tick both 

    read:repository:bitbucket and write:repository:bitbucket - clone only would just be read

  4. Perform the clone by executing the command below which includes your username/token in the URL command (you can find your username by clicking the gear cog icon and selecting Personal Bitbucket Settings - it's visible under the Bitbucket Profile Settings heading):
    git clone https://username:APIToken@bitbucket.org/workspaceID/reposlug.git

Please let me know how this goes.

Cheers! 

Ben (Bitbucket Cloud Support)

Matthew Soh July 4, 2025

Thanks, Ben - this works!

I remember trying it before with a scoped token, but I must have chosen the wrong permissions. When that failed, I assumed that omitting the scope would grant all permissions.

 

Like Ben likes this
Matthew Soh July 4, 2025

 The username x-bitbucket-api-token-auth works as well. 

Like Ben likes this

Suggest an answer

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

Atlassian Community Events