19

I'm trying push some changes done during Azure pipeline using cmd component as follows,

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

But it fails showing following error.

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

I already set the necessary permission as follows:

enter image description here

And the Allow scripts to access the OAuth token is also enabled as mentioned here

What other permissions do I need to give this to work?

Shayki Abramczyk
  • 24,285
  • 13
  • 49
  • 65
Channa
  • 2,301
  • 5
  • 28
  • 58

2 Answers2

18

You need to grant the permissions to Project Collection Build Service (account name):

enter image description here

Shayki Abramczyk
  • 24,285
  • 13
  • 49
  • 65
12

It should caused by your account do not have the contribute permission for this repository.

Go Project setting --> Repositories --> click Repos you want to operate -->set repository permissions accordingly.

enter image description here

Merlin Liang
  • 13,166
  • 1
  • 7
  • 18
  • There isn't a "Project Collection Build Service (???)" user - how come? I set the permissions on the "Project Collection Build Service Accounts" but that didn't do it.. https://imgur.com/0zBsIew thanks – dan Jun 25 '19 at 05:34
  • 3
    @dan, "Project Collection Build Service (xxx)", this is the identity which exist in project.You can add it in it with the "Add" button, and search "Project Collection Build Service (xxx)"(user, not group). The reason that no work to set permission on "Project Collection Build Service Accounts" for you, is you may did not add this user(Project Collection Build Service(xxx)) into this group. You can check this under your Org setting-->Permissions. – Merlin Liang Jun 25 '19 at 06:48
  • Follow this answer - worked for me. Secret is to copy the user UUID from the error message and paste it into the 'Search' box - it reveals a user that is not shown on the page by default. Then just add Contribute permissions. https://stackoverflow.com/a/55995046/923410 – Rob Potter May 05 '21 at 07:49