Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can't use Workspace Access Token to create a branch subject to branch permissions

Jay Seletz March 22, 2023

I have a script that creates branches in Bitbucket in numerous repos.  Until now I've been using a dedicated Bitbucket User to do this.  I recently switched to using the new Workspace Access Token feature.  This worked until I tried to create a branch in a repo with Branch Permissions that limit write access to certain branch types to a single group (which that dedicated user I'd been using previously has been in).  

Using the Access Token, which has the "repository:write" scope, the push to create the new branch fails with `remote: Permission denied to create branch`.  I believe it's due to the branch permission.  Should this work?  Is there a way to give the Auth Token user permission here?

3 answers

0 votes
Nathan Hitchman May 22, 2024

Hi, did anyone find the way around this? I have the exact same problem.

Documentation mentions nothing.

0 votes
Martin Karing
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!
April 27, 2023

I encountered the very same issue. I'm trying to push changes to a repository using a workspace access token, but I'm blocked by the branch restrictions. Those branch restrictions are required for the normal operations done by the developers, the script is required to bypass those.

I tried to get this working using the access tokens, but failed so far. I tried adding the access token to the branch restrictions as exception, both by the user interface of bitbucket and by the API of bitbucket. Both methods failed.

0 votes
Jay Seletz March 22, 2023

Just did some targeted testing.  A branch permission restricting edit will prevent both creating a branch matching the restriction, as well as pushing changes.  How can an Access Token be used in this case?  

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events