The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Is there a way to always enforce Pull Requests instead of allowing pushing directly to a repository?

Christoffer Pettersson
Contributor
November 19, 2013

Hey.

I am new to Atlassian Stash, but I have been playing around for a day now.

Looking at the "Repository Pemissions" page:

https://confluence.atlassian.com/display/STASH028/Using+repository+permissions

I can read that a user with the WRITE permission can create a Pull Request, approve and merge it, but also Push directly to the repository.

It seems like users with the WRITE permission can bypass all kinds of code review by pushing directly to the branch, hence by ignoring to create Pull Requests.

Is there a way that enforce that all commits to master has to be done via Pull Requests?

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Christoffer Pettersson
Contributor
November 19, 2013

Oh I see that this question has already been asked here:

https://answers.atlassian.com/questions/152360/branch-permissions-only-allow-commits-via-pull-request

And it is not possible.

7 votes
Deleted user
March 15, 2017

Branch permissions now support separate permissions for writing directly to the branch vs merging via pull request.

Nathan Jangula
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!
February 13, 2019

This needs to be heard!  I wish there was a way to resurrect this.

Like • kingdonb likes this
kingdonb
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!
February 13, 2019

Per my reply below the fold, you can also "Prevent a merge with unresolved merge checks" which is big, too.

Like • Nathan Jangula likes this
2 votes
Richard Cross
Contributor
March 13, 2015

UPDATE:  This functionality is now a part of Bitbucket.  Under Repository Settings > Branch Permissions,  you can select any branch (e.g. ā€œmasterā€) and then add the restriction ā€œPrevent changes without a pull requestā€.

Previous Answer:

There are two 3rd party plugins that provide this missing functionality - "Pull Request Please" and "Workzone".

A JIRA was raised way back in 2012, but I don't think there's any chance of it being actioned.

 

1 vote
kingdonb
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!
January 2, 2018

This story appears to be substantially improved now: https://confluence.atlassian.com/bitbucket/suggest-or-require-checks-before-a-merge-856691474.html

You can separately grant permissions to individual branches including both "Write" and "Merge via Pull Request"

You can also "Prevent a merge with unresolved merge checks"

Phillip McKeen
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!
February 13, 2019

Worth noting: preventing merge based on merge checks is (or was when I last checked) a premium feature.

Like • # people like this
1 vote
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 19, 2013

You could setup Branch Permissions so that only certain people can write to a branch.

Christoffer Pettersson
Contributor
November 19, 2013

True, but I want everyone to be able to approve and merge, and I want everyone to create Pull Requests, but no one to push directly to the branch.

The problem, I think, is that the WRITE permission allows both approve+merge AND pushing directly. So if we want to enforce code review, we need to enforce Pull Requests. But with the WRITE permission you can bypass creating Pull Requests and push your commit directly to the branch, bypassing the whole code review process.

So my question still stands; Is there a way that enforce that all commits to master has to be done via Pull Requests?

Like • Aaron Liu likes this
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 19, 2013

Sorry, I missed where you want to people to still be able to approve and merge.

You could setup a pre-receive hook by creating a plugin that prevents pushes to certain branches. See this answer for more details.

There is an open JIRA issue to do what you need without having to write a plugin, see STASH-2910.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events