Forums

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

Using APi Tokens for repo cloning

Daniel Jurkowski
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2025

Hello. I’m unable to clone a repository using an API token. I’ve gone through the documentation and checked related threads on this forum.

I’ve tried cloning both via WebStorm and directly from the command line using git clone.
I tested different formats, including cloning with just the username and also with the username and token separated by a colon.

In the best case, I end up with this error: 

Your credentials lack one or more required privilege scopes. fatal: unable to access 'https://bitbucket.org/***/***.git/': The requested URL returned error: 403

I’m wondering if I granted the correct permissions when creating the token.
Is the admin:repository:bitbucket scope sufficient for cloning a repository, or do I need to include other scopes as well?

1 answer

0 votes
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 14, 2025

Hey @Daniel Jurkowski 

Welcome to the community!

You'll need to supply two scopes on your token. Could you generate a new API token with

repository:read
repository:write

Make sure to generate it at https://id.atlassian.com/manage-profile/security/api-tokens

Your clone URL should look similar to this

git clone https://{bitbucket_username}:{api_token}@bitbucket.org/{workspace}/{repository}.git

Let me know how it goes.

Regards,
Syahrul

WBClark October 20, 2025

This is clearly not true.  I have repository:read and repository:write and I get the same error when trying to clone in SourceTree.  Also of note, the remote tab on the interface does not show remote repos and indicates that there are missing permissions.

I also note that Atlassian is having cloud issues today and perhaps thats the entire problem.

 

WBClark October 21, 2025

The cloud issues (AWS related) have cleared up, and I can confirm one issue I was referring to above.  The "Remote repositories" list in SourceTree does not list any repos, and there is a red X over my icon.  Hovering over that icon, I get a tooltip that says "Failed to list workspaces for user" and then two statements saying "Your credentials lack one or more privilege scopes".

I have the following scopes:

  • read:package:bitbucket (this one seems to allow for cloning but has no description)
  • read:repository:bitbucket
  • read:user:bitbucket
  • write:repository:bitbucket

I also want to state that I agree with the answer to the extent that these should all be read operations and should be covered under read:repository:bitbucket, but I'm not sure there isn't some other plan considering that read:package:bitbucket seems to be an afterthought (since it has no description) and allows cloning.  This might need to be a bug report for Sourcetree otherwise, but I'm not sure.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events