如何授予 Git 'ForcePush' 权限以将 bfg-repo-cleaner 结果推送到 VSTS?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46213673/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:53:52  来源:igfitidea点击:

How do I grant Git 'ForcePush' permissions for pushing bfg-repo-cleaner results to VSTS?

gitpermissionsazure-devops

提问by Jonathan

A person in my company who's an admin on the company's VSTS project created a repo for me, and granted me all permissions on the masterbranch.

我公司的一个人是该公司 VSTS 项目的管理员,他为我创建了一个 repo,并授予我对该master分支的所有权限。

Now I need to run BFG Repro-Cleaneron my repo. It worked great locally, but when I tried to git pushmy mirrored clone, I got:

现在我需要在我的仓库上运行BFG Repro-Cleaner。它在本地工作得很好,但是当我尝试使用git push我的镜像克隆时,我得到:

! [remote rejected] user/<someone_else>/<branch> -> user/<someone_else>/<branch> (TF401027: You need the Git 'ForcePush' permission to perform this action. Details: identity <my identity>, scope 'branch'.)
! [remote rejected] refs/pull/<number>/merge -> refs/pull/<number>/merge (TF401027: You need the Git 'ForcePush' permission to perform this action. Details: identity <my identity>, scope 'branch'.)
error: failed to push some refs to 'https://<repo>'

What permissions should I ask my admin to grant me so I can complete this? How would she do that from VSTS web UI?

我应该要求我的管理员授予我什么权限才能完成此操作?她将如何从 VSTS Web UI 做到这一点?

回答by Marina Liu

To set Force push permission for a branch, it's located in Branch Security. If you are an administrator for the team project, you can also set it by yourself. Detail steps of setting as below:

要为分支设置强制推送权限,它位于Branch Security。如果您是团队项目的管理员,您也可以自行设置。详细设置步骤如下:

In the VSTS team project -> Code Tab -> selected the repo you are working for -> Branches Tab -> select the branch you want to set force push permission -> button -> Branch Security -> set the group you are in or add your account as user -> set Force push to Allow-> save changes.

在 VSTS 团队项目 -> Code Tab -> 选择你正在工作的 repo -> Branches Tab -> 选择你想要设置强制推送权限的分支 -> 按钮 -> Branch Security -> 设置你所在的组或将您的帐户添加为用户 -> 将强制推送设置为允许-> 保存更改。

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

回答by Anton

Additional to https://stackoverflow.com/a/46215134/7851959above. You have to do the same for the branch and for the repository (Code -> Manage Repositories). Also keep in mind about default configuration: Project Collection Administratorsgroup doesn't have the Force Push permissions.

除了上面的https://stackoverflow.com/a/46215134/7851959。您必须对分支和存储库(代码 -> 管理存储库)执行相同的操作。还要记住默认配置:项目集合管理员组没有强制推送权限。