Pushing changes to repo from Azure Pipeline
From time to time, there is a need to touch git repository from the pipeline - push tag, push commit with release notes, whatever your process need.
To properly configure such functionality, you have to:
- explicitly mark that pipeline must persists git authentication after repository checkout:
jobs:
- job: myJob
displayName: 'My job'
steps:
- checkout: self
persistCredentials: true- on the repository level, in the Security tab, you need to assign
Contributepermission forProject Collection Build Service ({OrgName})user:

Error
The below error you will get, if you will not set the proper permission:
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.250.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /azp/_work/_temp/bfcd49a4-4f2e-4045-86ad-7eb13b6fdda9.sh
remote: 001f# service=git-receive-pack
remote: 0000000000aaTF401027: You need the Git 'GenericContribute' permission to perform this action. Details: identity 'Build\***', scope 'repository'.
remote: TF401027: You need the Git 'GenericContribute' permission to perform this action. Details: identity 'Build\***', scope 'repository'.
fatal: unable to access 'https://dev.azure.com/<org>/<project>/_git/<repo>/': The requested URL returned error: 403If you are interested in the pipelines permissions and scopes, you can find more info in the documentation:
