Forums

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

Restricting creating branch by push

Wiryono
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!
September 25, 2024

Hi is there a way to restrict pushing new branch unless specify in the branch permission ?


Lets say I have this branch specify in the branch restriction

main

test

dev/*

feature/*

release/*

 

How do I make sure they not pushing "my-custom-unknwon-branch" to this repo

1 answer

0 votes
Ulrich Kuhnhardt _IzymesCo_
Atlassian Partner
September 25, 2024

If you were on Bitbucket server you could add a custom server side pre-receive hook.

Since you're on Bitbucket cloud there is no such mechanism in place.

There is a 10-year old feature request - https://jira.atlassian.com/browse/BCLOUD-10471 - for allowing server-side pre-receive hook. You are welcome to vote for and watch this issue.

Atlassian proposes a work-around of using custom merge-checks based on the Forge platform. I think you could create a custom merge-check that check the PR source branch pattern and veto the PR if the PR source branch pattern is not valid, i.e. 'my-custom-----'

This is not exactly what you are asking for, but it would discourage users to push random branch names because the PRs that they create, won't get merged.

Merge-checks allow you to display a message, which you could use to 'educate' the person that pushed the custom branch name.

Hope that helps

Best, Ulrich

// Izymes

Suggest an answer

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

Atlassian Community Events