Anyone with admin permissions to an organization-owned repository can enable branch restrictions.
You can automatically enforce protected branch settings for some or all branches in your repository. For more information, see "Configuring protected branches."
- On GitHub Enterprise, navigate to the main page of the repository.
- Under your repository name, click
- In the left menu, click Branches.
- Next to "Branch protection rules", click Add rule.
- Under "Branch name pattern", type the branch name or pattern you want to protect.
- Optionally, select Include administrators. This enforces all configured restrictions for repository administrators.
- Under "Protect matching branches", select Restrict who can push to matching branches.
- Search for and select the people, teams, or apps who will have permission to push to the protected branch.
- Click Create.