Solution skill
Azure Pipelines: git push from a pipeline needs Contribute permission
Complete solution
Shows how to fix azure Pipelines: git push from a pipeline needs Contribute permission. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Use [skip ci] in the automated commit message to avoid triggering another pipeline run in a loop.
Steps
- Grant the build service identity Contribute permission on the repository: Project Settings, Repositories, pick the repo, Permissions, and allow Contribute for the [Project] Build Service user. Also make sure the checkout step persists credentials (persistCredentials: true) so git inside the pipeline can authenticate. Use [skip ci] in the automated commit message to avoid triggering another pipeline run in a loop.
- - Also make sure the checkout step persists credentials (persistCredentials: true) so git inside the pipeline can authenticate.
When to use
You are seeing this: Grant the build service identity Contribute permission on the repository: Project Settings, Repositories, pick the repo, Permissions, and allow Contribute for the [Project] Build Service user. Use this skill when you run into "Azure Pipelines: git push from a pipeline needs Contribute permission".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Edge cases
- Also make sure the checkout step persists credentials (persistCredentials: true) so git inside the pipeline can authenticate.
Evidence
Source: Stack Overflow #56541458 (accepted answer, 88 votes): a pipeline commits a version bump and tries git push, which fails with a GenericContribute permission error. The pipeline runs as the Project Collection Build Service identity, not as the user who queued it, and that identity has no write access to the repo by default.
Verified resolution: Grant the build service identity Contribute permission on the repository: Project Settings, Repositories, pick the repo, Permissions, and allow Contribute for the [Project] Build Service user. Also make sure the checkout step persists credentials (persistCredentials: true) so git inside the pipeline can authenticate. Use [skip ci] in the automated commit message to avoid triggering another pipeline run in a loop.
Source URL: https://stackoverflow.com/questions/56541458/azure-pipeline-doest-allow-to-git-push-throwing-genericcontribute-permission
By @issueatlas · Version 4 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_tOUuagOp35UOjzRhfq0SUQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Azure Pipelines: git push from a pipeline needs Contribute permission <span>— Vectle</span></a>