Azure Pipeline Does't Allow to Git Push Throwing 'Genericcontribute' Permission Is Needed

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

steps:
- script: |
   git config user.email [email protected]
   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:

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?

0

4 Answers

If you get the following error in your build...

TF401027: You need the Git ‘GenericContribute’ permission to perform this action. Details: identity

...then, to fix it:

  1. Copy the guid part of the identity name from the error message
  2. Go to the repository settings
  3. Paste the guid into the permissions search box for user or group.
  4. This will then display a “Project Collection Build Service (OrganisationName)”. Select that user
  5. Set the permissions as stated in other answers.
4

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

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.

3

Even if you have permission but still not able to push the code. Please follow the below steps.

  • Please check if you have a valid user and password configured in git. If not follow the below steps.

  • Go to Repository and create a personnel access token which you will use as a password for committing and pushing the code to repos along with your username.

So the best way you can configure your URL while doing the clone.

GitLab Example :

GitLab URL for clone: 



GitLab configured URL for clone:

[email protected]/myrepo/demoProject.git. // Follow this approach to clone

Azure Example :

Azure URL for clone: 

https://[email protected]/MY-ORG/MyRepo/_git/demo

Azure configured URL for clone:

[email protected]/MY-ORG/MyRepo/_git/demo // Follow this approach to clone

Once you are able to clone these repos then you are all set to commit and push your code.

That’s all. It will save your day!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest