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