Home > Enterprise >  How can we prevent admins pushing to a branch on GitHub without requiring reviews?
How can we prevent admins pushing to a branch on GitHub without requiring reviews?

Time:10-04

It used to be possible to protect a branch of GitHub and simply prevent pushing directly to that branch. Now, when configuring branch protections, there is a checkbox called "Require approvals" that can not be unselected if pull requests are required before merging:

enter image description here

How can we require a pull request (disable direct pushing to a branch) without requiring approvals? Our goal is to prevent accidental conflicts in the main branch, by enforcing the workflow that everyone (even administrators) should make a pull request to merge changes rather than committing directly.

CodePudding user response:

I would imagine that the current solution you have in the screenshot would provide this?

If even admins of the repo need to submit PR's then that in turn means everyone needs to submit PR's, then requiring one approval wouldn't be an issue as the author of the PR can just approve it themselves before merging it? After checking the diff / automated builds for merge conflicts of course.

CodePudding user response:

Use the checklist only if you want additional features to your branch protection rule. What you seem to want is a protection rule without any of those additional features.

  • Related