Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Branch Protection Rules - disable "Require Approvals"

Something has changed on GitHub's branch protection rules page recently (?).

Require approvals is always enabled (in checked state). Is there any way to disable it? Previously, I'm pretty sure this was possible. Now it's confusing, especially since the description says "When enabled, ...", suggesting that there is a way to disable it.

enter image description here

like image 590
friederbluemle Avatar asked Oct 18 '21 00:10

friederbluemle


People also ask

How do you turn off the protection on that branch?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. In the "Code and automation" section of the sidebar, click Branches. To the right of the branch protection rule you want to delete, click Delete.

What are GitHub branch protection rules?

Git branch protection rules are a powerful configuration option that enables repository administrators to enforce security policies. This helps protect the git branches from unexpected code commits or deletion by any unauthorized person(s) / user group(s).


Video Answer


1 Answers

At this time of writing, there seems to be no point for this checkbox to be disabled, because its state does seem to influence the repository settings. It feels like the UI changes to the Branch protection rule page are still a work in progress.

Trick using Dev Tools

You can enable it using your browsers Developer tools and removing the disabled="disabled" attribute of the <input> element, at which point you may uncheck the checkbox.

The dropdown for the required number of approval now disappears.

enter image description here

Once you uncheck it and subsequently save your Branch protection rule, it will reset the required amount of approvals to zero, even though the checkbox resets to its disabled state.

enter image description here

At this point you don't need any approvals to merge into the protected branch.

enter image description here

This trick allows small teams or single developers to continue using Pull Requests to organize their workflow, without enforcing PR approvals.

like image 163
Sigge Avatar answered Oct 17 '22 05:10

Sigge