Today, while I was working on an article that talks about Azure Data Factory – Collaborative development of ADF pipelines using Azure DevOps – Git I had to create and delete branches. While deleting, i got an alert with the message Failed to delete branch. Force push permission is required to delete branches.
I was surprised to see that message as I was logged in as an user with the Project Administrator role and of Basic Access Type. Moreover, it was me with the same account who has created that branch.
After researching, I noticed that somehow the property Force Push was Not Set for the branch that i was trying to delete.
And, after setting the Force Push value to Allow, then I was able to delete that branch.
In order to edit the Force Push, you need to navigate to the branch which you want to delete, click on the three dots to open up the context menu as shown below.

Once you click on the Branch Security in the previous step, you will get a popup where you can edit allow the Force Push for that branch as shown below.

After setting the Force Push to Allow, you will be able to delete the branch.
Happy learning!
Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups
This worked, thank-you!
LikeLike
How do we set this for all, and all new, branches?
LikeLike
Go to Project Settings. Under the Repos header, choose Repositories. On the Repositories page go to the Permissions tab. Search for your user account (or the team, group, etc. you want to edit). Change Force push (rewrite history, delete branches and tags) to Allow
LikeLike
Indeed. Doing this for every branch is a lot of work 😦
LikeLike
Thanks! Very helpful!
LikeLike
Thank you. It works.
LikeLike