8

My company is using VSTS with git. The Access Control Summary settings seemed to have changed since yesterday in VSTS. I'm seeing a few more options than I was before.

I'm a member of the MyRepository Administrators and MyRepository Team.

I'm getting a:

2017 tf402455: pushes to this branch are not permitted; you must use a pull request to update this branch. 

when I try to delete the source branch from a completed pull request, despite the fact that that I have made given Allow permissions to MyRepository Administrators and MyRepository Team for Force push (rewrite history and delete branches) Normally I jut give the force push permissions for the MyRepository administrators when I do this. I added the permissions to MyRepository Team after I saw the tf402455 when I'd done it just for Administrators.

This is the kind of thing that I do multiple times a day. Have the permissions required to do this changed? The UI for VSTS seems to change every couple months and you have to spend a couple days figuring out how to do routine tasks again.

Eric
  • 2,861
  • 6
  • 28
  • 59
  • 1
    I'd guess someone enabled a Branch Policy for this branch. Try temporarily turning that off. – jessehouwing Feb 03 '17 at 18:32
  • I'll see if I can find it. I just tried the same thing on a different feature branch and it worked! Like I said this is something I do every day. With the changes to VSTS the currently selected VSTS group doesn't display properly in the Edge browser. When you choose a group you see the Access Control Summary change, but the bar to show which VSTS group is selected is way too faint. It was much more obvious yesterday. – Eric Feb 03 '17 at 18:35
  • The branch policy was the problem. It was apparently unrelated to the UI changes in VSTS, could you make your comment the answer? – Eric Feb 03 '17 at 20:23
  • Related: https://stackoverflow.com/questions/63372674/how-to-remove-merged-feature-branches-in-azure-devops/63389484 – GaTechThomas Apr 22 '21 at 20:03

4 Answers4

10

It looks like there is a branch policy in place which protects this branch. Whether it should be protecting you from deleting the branch or not is debatable though.

You should be able to delete the branch after removing the branch policy.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
6

As other users were suggesting, If any required branch policies are enabled, the branch cannot be deleted and changes must be made via pull request. I will provide some screenshots to help the people who are new to Azure DevOps.

Click on the Branch Policy icon, you can also click on the three dots and click on the Branch Policies menu item.

enter image description here

Make sure that every toggle is turned off.

enter image description here

If there are Project level cross policies enabled, you will not be able to edit them in the branch policies as in the previous screenshot. To check that, click on the Project settings and then Repositories.

enter image description here

Then turn off the related policies (Not recommended though). Once you are done, you can turn them on.

enter image description here

There are also branch policies applied to the common branch namespaces like dev and master. To make it editable in the individual branch view (dev branch of a different repository), we need to make the changes here too. For example, I have these repository settings for dev, default, master.

enter image description here

Just in case, if you would like to create one, click on the + icon in the top right corner of the above screen, and then click on the Protect current and future branches matching a specified pattern, and then give a common branch name in the textbox, click on the create button. You can set the policies you want to enable on the next screen.

enter image description here

Try again!.

Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
4

On Azure DevOps Groups, you must disable this policy:

enter image description here

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
2

You can also update the branch policy to enable this. Here for more details https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops

A. Wentzel
  • 484
  • 8
  • 16