Reputation: 782
I have posted this on github.community but it hasn't drawn any solutions.
I am trying to protect the master branch from single person direct push: every change must be made through a (feature) branch followed by pull request to be approved by another (or a specific) developer. In the repo's settings this feature seems to be able to do this:
Require pull request reviews before merging
When enabled, all commits must be made to a non-protected branch and submitted via a pull request with the required number of approving reviews and no changes requested before it can be merged into a branch that matches this rule.
I have turned this on, setting the branch pattern to "master" and the number of required approving reviews is set to 1. But unfortunately, when I try to push to origin/master, it goes through. Is this not the feature I want or is something not set right?
Thanks
Upvotes: 16
Views: 10976
Reputation: 782
The problem was that I was admin for this repo and unless I tick the box "Include administrators" "Do not allow bypassing the above settings" I am allowed to do direct pushes.
Curiously I am not shown as administrator under the repo's settings->Collaborators & Teams but I can see this using the Organisation's account.
Upvotes: 22