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?
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.