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

How can I manage permissions in "children" branches?

gcover January 6, 2023

We have a branch structure for releases that is locked down permissions wise - `release/*` has very few write access, and only PR merge permissions.

I now want to create a structure where folks can create branches with the following name `release/*/child/*`. Having configured the permissions, and I understand there's overlap here with the first schema, we're seeing an error about not being able to create a branch while the "parent" exists.

Is this an odd wording of a permission related error (the overlap)? If I"m not able to achieve this, what are my other options given these ideals:

  • Folks can create branches "from" the release branch
  • Some folks can commit/push directly to that branch
  • Other folks can only merge via PR
  • When browsing branches it's easy/obvious what release a child branch comes from

That last point is the idea behind putting the branch names after the release...but if that's not going to work, I'm a bit short of ideas atm.

Thanks

 

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 10, 2023

Hi @gcover and welcome to the community.

If there is a branch restriction for release/* and only certain users have write access, then only these users will be able to create a branch starting with release/. This was by design, and we have a feature request to change this here:

I would suggest adding your vote (by selecting the Vote for this issue link) and a comment to it to express your interest.

If branch permissions overlap, the results are determined by the table on the following documentation page:

Please keep in mind the following though:

If you already have a branch named release/123, it will not be possible to create a branch named e.g. release/123/child/456. This is a limitation of Git (and not Bitbucket) and it doesn't have anything to do with branch permissions.

Branches with the pattern A/B exist as a file named B in a folder named A. If you already have another branch named A, it will not be possible for Git to create a folder named A in order to save the branch A/B.

If you have locally a branch named release/123, then trying to create a branch release/123/child/456 is going to show the following error:

$ git checkout -b release/123/child/456
fatal: cannot lock ref 'refs/heads/release/123/child/456': 'refs/heads/release/123' exists; cannot create 'refs/heads/release/123/child/456'

You could work around this issue by creating a branch named release/123-child/456, so using the pattern release/*-child/* instead of release/*/child/*

Kind regards,
Theodora

gcover January 10, 2023

Thank you for the information, both on the Bitbucket side, and reminding me about the structure of git branches. I can work with this structure now to create something that works for us.

Like Theodora Boudale likes this

Suggest an answer

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

Atlassian Community Events