Git删除TFS git存储库中的远程分支

Eat*_*oku 30 git tfs azure-devops

我们在Team Foundation Service中使用git,我们正在尝试通过运行以下命令来找到删除远程分支的方法.

git push origin --delete TheBranchName
Run Code Online (Sandbox Code Playgroud)

远程服务器一直拒绝以下错误

 ! [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'
Run Code Online (Sandbox Code Playgroud)

任何想法如何在TFS中为用户设置正确的权限?

Urs*_*gor 22

可以在
1 处访问存储库的安全选项 .代码 - >资源管理器
2.从资源管理器中选择一个
存储库3.在存储库的详细信息中,您应该单击资源管理器旁边的存储库名称.
4.选择Manage repositories ...菜单

在这里,您可以为存储库及其分支配置每个贡献者组和各个用户的权限."重写和破坏历史(强制推送)"选项应该允许或继承允许强制推送.


MrD*_*pan 6

要删除远程分支,您可以使用:

git push origin :TheBranchName
Run Code Online (Sandbox Code Playgroud)


Dav*_*ulp 3

git push手册页:

-f
--force
    Usually, the command refuses to update a remote ref that is not an ancestor of the
    local ref used to overwrite it. This flag disables the check. This can cause the
    remote repository to lose commits; use it with care.
Run Code Online (Sandbox Code Playgroud)

看起来您尝试删除的分支不是您所在分支的祖先 - 添加此--force参数并查看是否有帮助。