Article version: Enterprise Server 2.21

Enabling deletion of a protected branch

You can allow anyone with write access for a repository to delete a protected branch.

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.

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

By default, you cannot delete a protected branch. When you enable deletion to a protected branch, anyone with at least write permissions to the repository can delete the branch, including those with admin permissions.

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 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. Under "Rules applied to everyone including administrators", select Allow deletions.
    Allow branch deletions option
  7. Click Create.

Ask a human

Can't find what you're looking for?

Contact us