Block writing to Master in Stash?

I'd like to enforce that any development be done by branching the code, putting it through review and then performing a pull request to merge with the master branch. How exactly do I need to set this up?

It looks like the repository permissions *write* setting grants *both* the ability to merge and the ability to push. Is there any way around that? I really don't want it to be possible to push directly to master without going through a review. I'm guessing some kind of hook is necessary but I'm more of a sysadmin.

2 answers

1 accepted

Hi Tim,

One method of achieving this workflow in Stash would be to use a gatekeeper style workflow. I gave an overview of this workflow in this question.

There is also an example hook which would stop people from pushing to one branch in a repository and only allow pull requests to be merged, you could compile and extend this example to suit your needs.

Hope that helps,


Thanks. The example hook looks promising. The Workzone hook also looks good, if I can get it tweaked appropriately.

Folking workflow meets your requirements, it needs a project keeper to review/decline the writing to master, in this case, each person has its own master repo and project keeper can finally decide if the change can come into repo master, please see more:!workflow-forking

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

26,715 views 26 12
Join discussion

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