Today, while I was working on an article that talks about Azure Data Factory – Collaborative development of ADF pipelines using Azure DevOps – Git (article coming soon) 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.