It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can I restrict developpers to only push to feature/*?

This question is in reference to Atlassian Documentation: Branch permissions

We are following the git flow pattern, and we would like to enforce developpers to push to feature/* to follow the workflow. Only administrators should be able to push and merge in master and develop. How can we achieve this?

2 answers

1 vote
Jim Redmond Atlassian Team Jan 25, 2017

Administrators should have a "Branch permissions" item in the repo settings where you can specify all of this. It sounds like you'd just need to set permissions on "master" and "develop" so that only the administrator group (or a list of individual admins) is permitted to push or merge to those branches. Any branch not specified in the list would then be open to anyone 

More info: https://confluence.atlassian.com/bitbucket/branch-permissions-385912271.html

Thank you for your answer! But this is exactly what we configured in the branch permissions tab of our repository, and this doesn't prevent developpers from creating branches named "random" which break the git flow integration of source tree!

The idea is to prevent them from creating anything else than `feature/*` branches.

Did you ever figure this out @Maxime Rossini1 or @Jim Redmond? We have the same question. I know that I can set perms to prevent devs from writing into develop, but I want to stop anyone from being able to create a branch called 'ABC-123' off of develop...we want them to only be able to create branches like 'feature/ABC-123' but it looks like maybe this option is only available in Bitbucket Server? Can you or anyone else confirm?

0 votes

@Maxime Rossini1 & @David Jackson - Thanks for your patience on getting a resolution to your issue. Atlassian has since added the 'Branching model' feature to the 'Workflow' section in Settings. The 'Branching model' allows you (and your team) to make consistent naming decisions when creating branches. See 'The Branching model' section of the 'Branching a Repository' doc for more info: https://confluence.atlassian.com/bitbucket/branching-a-repository-223217999.html

Check out the blog post that introduces the Branching model: https://bitbucket.org/blog/introducing-bitbucket-branching-model-support

Great addition! Seems like it doesn't solve the initial problem though, but it allows for a better web experience on bitbucket, and will for sure provide goo integrations capabilities with other softwares like Jira.

Hey @Maxime Rossini1 - Thanks for your reply and feedback. You're right. I did not directly address the initial problem - "Only administrators should be able to push and merge in master and develop. How can we achieve this?You should be able to set permissions as per the branching model (pattern) that you have set up, which allows you to restrict 'write access' and 'merging' to certain team members or teams (admins). There is an explanation of this functionality in the blog post: https://bitbucket.org/blog/introducing-bitbucket-branching-model-support. Is there a more specific solution you are looking for at the moment? 

Yes I was not specific enough in my last comment. In my first answer I added a little precision: "The idea is to prevent them from creating anything else than `feature/*` branches.". So basically, branch permissions can prevent team members to push to "master" or "develop", but they won't prevent them from pushing to ANY branch other than "feature/*" or "bugfix/*".

Like 1 person likes this

Hi Maxime - The team shipped branching model support as noted in Collin's response above, and is working on some additional improvements for the branch types in Bitbucket Cloud.

However, we're not planning to add the functionality to 'force branch types' at this point. We see it as a valid enhancement, which would add value for many customers, so please consider creating an enhancement ticket over at https://bitbucket.org/site/master/issues adding your use case and any detail there too. We'll then be able to weigh up its priority with the other requests.

Kind regards

Martin

Bitbucket Cloud Product Manager

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,002 views 1 16
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you