Azure 管道不允许 git 推送需要 'GenericContribute' 权限

Azure pipeline does't allow to git push throwing 'GenericContribute' permission is needed

我正在尝试使用 cmd 组件推送在 Azure 管道期间完成的一些更改,如下所示,

steps:
- script: |
   git config user.email you@you.com
   git config user.name "your name"
   git diff
   git  add .
   git commit -m "version update [skip ci]"
   git push origin HEAD:master

但是显示以下错误失败。

remote: 0000000000aaTF41027: You need the Git 'GenericContribute' permission to perform this action. Details: identity 'Build\sdfdfjjkk', scope 'repository'

我已经设置了必要的权限如下:

并且 Allow scripts to access the OAuth token 也已启用

我还需要什么其他权限才能让它工作?

您需要授予Project Collection Build Service(账户名)权限

应该是你的账号没有对这个仓库的contribute权限造成的。

Go Project setting --> Repositories --> 点击 Repos 你想要的操作 --> 相应地设置存储库权限。

如果您收到“TF401027:您需要 Git ‘GenericContribute’ 权限才能执行此操作。详细信息:构建中的“身份”错误。首先复制身份名称的 guid 部分并将其粘贴到用户或组的搜索中。然后将显示“项目集合构建服务(组织名称)”。按照其他答案中的说明设置权限。