Azure DevOps – Failed to delete. Force push permission is required to delete branches

I’ve recently been tidying up some of my personal project code repositories in Azure DevOps, treating them like professional environments where possible to get myself into some better habits. Part of this is ensuring that old branches are properly cleaned up and removed where no longer required.

But I kept receiving an error when trying to delete a branch that stated “Failed to delete ‘branch’. Force push permission is required to delete branches” which is less than ideal, and somewhat confusing considering I’m logged in as an Organization owner with full Admin rights on the related project.

An example of the error encountered

The Fix

Luckily, the fix in this case proved to be quite straightforward. I ensured that on each individual branch, I had the Force push permission set to Allow. This permission was either for a group containing my user or directly on my user.

Individual Branch

You can do this by following the steps below for each individual branch –

  1. Navigate to the Branches page under Repos.
  2. Hover over the relevant branch and select the ellipses icon to open the menu.
  3. Select Branch Security.
  4. Select a group containing your user or your user account.
  5. Set ‘Force push (rewrite history, delete branches and tags)‘ to Allow.
  6. Try to delete the branch again and it should work.

Entire Project

If you’d like to implement the fix for all repositories in the project then you can follow the steps below instead –

  1. Navigate to Project Settings.
  2. Select the Repositories page found under Repos.
  3. Navigate to the Security tab.
  4. Select a group containing your user or your user account.
  5. Set ‘Force push (rewrite history, delete branches and tags)‘ to Allow.
  6. Try to delete the branch again and it should work.

Further information on Git branch security can be found on Microsoft Learn at Microsoft Learn – Azure DevOps – Set branch permissions

One response to “Azure DevOps – Failed to delete. Force push permission is required to delete branches”

  1. 1518sdf759 Avatar
    1518sdf759

    resplendent! Developing: Focus Shifts to [Key Aspect] of [Event] 2025 remarkable

    Like

Leave a reply to 1518sdf759 Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Design a site like this with WordPress.com
Get started