Enabling required status checks

Repository administrators can 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.

Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see "GitHub's products."

You can automatically enforce protected branch settings for some or all branches in your repository. For more information, see "Configuring protected branches."

Before you can enable required status checks, you must configure the repository to use the status API. For more information, see "Building a CI Server" in the GitHub Developer documentation.

  1. On GitHub, 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. Under "Protect matching branches", select Require status checks to pass before merging.

    Required status checks option

  7. Optionally, select 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

  8. From the list of available status checks, select the checks you want to require.

    List of available status checks

  9. Optionally, select Include administrators. This enforces all configured restrictions for repository administrators.

    Include administrators checkbox

  10. Click Save changes.

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