What the default does#
GitHub's documentation is direct about the default: "By default, the restrictions of a branch protection rule do not apply to people with admin permissions to the repository or custom roles with the 'bypass branch protections' permission in a repository." Turning on Do not allow bypassing the above settings applies the restrictions "to admins and roles with the 'bypass branch protections' permission, too." About protected branches
In practice, every person with the admin role on a repository can merge a pull request that has no approval, push directly to the branch, or merge while required checks are failing, unless that box is checked. A few settings behave differently. Allow force pushes sits under "Rules applied to everyone including administrators" when you edit the rule. Managing a branch protection rule Restrict who can push to matching branches says that "People and apps with admin permissions to a repository are always able to push to a protected branch or create a matching branch," although required checks and required pull requests still apply to people on that push list. Restrict who can push
Rulesets work the other way around. A ruleset's rules apply to everyone except the actors on its bypass list, and repository admins are one of the roles you can choose to add. Granting bypass permissions The ruleset documentation shows the effect in one case: if force pushes are blocked, "organization owners or repository administrators will be unable to change or rename the default branch unless they are authorized to bypass the ruleset." Block force pushes
An approval rule that bound fewer people than it seemed#
Suppose a fictional organization, acme, gave the admin role on acme/payments-api to six engineers so they could manage webhooks and secrets. The main branch protection rule requires one approving review and the test check, and the bypass box is unchecked.
One of the six opens a pull request that changes how refunds are rounded and, with no approval yet, merges it using the admin exemption. The test check was green. CI passed, the code was never reviewed, and the review requirement everyone believed in did not apply to this author. A reader of the pull request sees a merged pull request with no approval. The audit log has more: the organization audit log event protected_branch.policy_override is described as "A branch protection requirement was overridden by a repository administrator." Audit log events for your organization
That record exists, but only organization owners can read the audit log, and it covers the last 180 days. Reviewing the audit log Unless someone reads it, the override is invisible to the people who rely on the rule.
The cause is upstream of branch protection. The admin role was granted for settings access, and the bypass came with it. Check who holds admin on a repository before deciding this setting, since the default's cost grows with that number.
What turning it on costs#
With the box checked, the six admins are held to the rule like everyone else. That has two costs.
The first is an emergency. When test is broken for reasons unrelated to the fix, or the only reviewer is asleep, no one can merge through the normal path. Without a bypass actor somewhere, the admin's remaining move is to edit the rule, uncheck the box or remove the check, merge, and restore it. During that window the rule is weaker for everyone it covers, and the change depends on someone remembering to restore it.
The second is that the setting binds admins only while they leave it alone. The REST API's admin enforcement endpoint says "Removing admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled." Delete admin branch protection The people the setting restrains are the people who can remove it. The organization audit log lists an event for the setting, protected_branch.update_admin_enforced, so a change leaves a record. It does not leave a barrier.
A configuration that keeps the exception narrow#
Separate settings access from merge authority, and make the exception a named path:
- Turn on Do not allow bypassing the above settings for the default branch and release branches now.
- Move those branches' requirements into rulesets, and give the ruleset's bypass list one small team in "For pull requests only" mode. The documentation says that mode requires the actor "to open a pull request to make changes," after which the actor can "bypass any branch protections and merge that pull request." Once the classic rule is deleted, that team is the only route around the requirements.
- Reduce the admin role to the people who manage repository settings. Where your plan offers custom repository roles, a role with the "edit repository rules" permission lets someone maintain rulesets without the rest of admin. Available rules for rulesets
- Read bypasses on a schedule. Rule insights lists actions that bypassed a ruleset, and the organization audit log lists overrides of classic rules.
Until the migration to rulesets is finished, the classic rule still applies, and a ruleset bypass does not lift its requirements, because the two layer and the stricter one wins. In that period the emergency path is editing the classic rule, and you should record that edit the same way you would record a bypass.
What the setting does not catch#
Applying the rule to admins makes them meet the same requirements as everyone else. It does not make those requirements meaningful: an approval from a reviewer who skimmed the diff still counts, a skipped job still satisfies a required check, and a bypass actor can still merge anything. It also does nothing about the admin role's other powers, such as editing workflows, secrets or the rule itself.
The decision#
Leave admins exempt only on repositories where the admins are the reviewers, such as a two-person project, and accept that the review rule is then advisory for them. Everywhere else, check the box, keep the admin list short, and put emergency merges behind a bypass list with a pull request attached. When someone does use an emergency path, record it as an exception with a follow-up review.