we are using git in Team Foundation Service, and we are trying to find a way to delete a remote branch by running the following command.
git push origin --delete TheBranchName
The remote server keep rejecting with following error
! [remote rejected] TheBranchName (TF401026: The ForcePush permission is required to perform this action.) error: failed to push some refs to 'https://xxx.visualstudio.com/DefaultCollection/_git/Xxxxxx'
any idea how to set correct permission to a user in TFS?
Create a pull request from the branch. Once the pull request is created, abandon it. Once you abandon the request, you are presented with a delete source branch button. Click that to delete the branch.
Right Click the Branch and click delete and then do a Check-in.
To delete a remote branch, you can't use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name ( origin in this case) after git push .
The security options can be accessed for the repositories at
1. Code->Explorer
2. Select a repo form the Explorer
3. At the details of the repository, you should click to the name of the repository beside the explorer.
4. Select the Manage repositories... menu
Here you can configure the rights of each contributor groups and individual users for repositories and their branches. "Rewrite and destroy history (force push)" option shound be Allow or Inherited Allow to be able to force push.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With