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

Repository administrators for organizations can enforce branch restrictions so that only certain users or teams are able to push to a protected branch.

Enabling branch restrictions

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

  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. Under Protected Branches, select the branch you want to restrict using the drop-down menu. Selecting a protected branch drop-down menu

  5. Select Restrict who can push to this branch. Branch restriction checkbox
  6. Search for and select the people or teams who will have permission to push to the protected branch. Branch restriction search
  7. Click Save changes.

Further reading