This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2020-05-23. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Article version: Enterprise Server 2.17

Configuring protected branches and required status checks

You can enable protected branches for limiting branch manipulation, as well as enforce required status checks before a branch is merged in a pull request or before commits on a local branch can be pushed to the protected remote branch.

In this article

Anyone with admin permissions to a repository can enable branch restrictions.

Enabling a protected branch for a repository

  1. On GitHub Enterprise, navigate to the main page of the repository.
  2. Under your repository name, click Settings.
    Repository settings button
  3. In the left menu, click Branches.
    Repository options sub-menu
  4. Next to "Branch protection rules", click Add rule.
    Add branch protection rule button
  5. Under "Branch name pattern", type the branch name or pattern you want to protect.
    Branch rule field
  6. Click Create.

Types of required status checks

Type of required status checkSettingMerge requirementsConsiderations
StrictThe Require branches to be up-to-date before merging checkbox is checked.The branch must be up to date with the base branch before merging.This is the default behavior for required status checks. More builds may be required, as you'll need to bring the head branch up to date after other collaborators merge pull requests to the protected base branch.
LooseThe Require branches to be up-to-date before merging checkbox is not checked.The branch does not have to be up to date with the base branch before merging.You'll have fewer required builds, as you won't need to bring the head branch up to date after other collaborators merge pull requests. Status checks may fail after you merge your branch if there are incompatible changes with the base branch.
DisabledThe Require status checks to pass before merging checkbox is not checked.The branch has no merge restrictions.If required status checks aren't enabled, collaborators can merge the branch at any time, regardless of whether it is up to date with the base branch. This increases the possibility of incompatible changes.

Enabling required status checks

  1. On GitHub Enterprise, navigate to the main page of the repository.
  2. Under your repository name, click Settings.
    Repository settings button
  3. In the left menu, click Branches.
    Repository options sub-menu
  4. Next to "Branch protection rules", click Add rule.
    Add branch protection rule button
  5. Under "Branch name pattern", type the branch name or pattern you want to protect.
    Branch rule field
  6. Select Require status checks to pass before merging.
    Required status checks option
  7. From the list of available status checks, select the ones you want to make required.
    List of available status checks
  8. Optionally, select Include administrators. This enforces all configured restrictions for repository administrators.
    Include administrators checkbox
  9. Optionally, deselect Require branches to be up to date before merging. If selected, this ensures that the branch is tested with the latest code on the base branch.
    Loose or strict required status checkbox
  10. Optionally, select Restrict who can push to this branch.
    Branch restriction checkbox
  11. Search for and select the people or teams who will have permission to push to the protected branch.
    Branch restriction search
  12. Click Create.

Tip: To successfully merge a pull request into a base branch that has required status checks enabled, the pull request's head branch must be up-to-date with the base branch.

Ask a human

Can't find what you're looking for?

Contact us