I'd like to do git push from a powershell script during in the Azure Devops release pipeline from a self hosted build server.
It works from the build pipeline, but from the release pipeline i end up with authentication errors. "Allow scripts to access the OAuth token" is activated and the build machines have contribution permissions (as i said, it works in the build pipeline).
This is the error i get as seen in the devops protal:
git : remote: 001f# service=git-receive-pack
At C:\Builds\A1\_work\r1\a\Source\Scripts\CreateTagFromPipeline.ps1:11 char:1
+ git push
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (remote: 001f# service=git-receive-pack:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PowerShell exited with code '1'.
If i log in to the machine i via remote desktop and push manually, i get some better errors:
$ git push
remote: 001f# service=git-receive-pack
remote: 0000000000aaTF401027: You need the Git 'GenericContribute' permission to perform this action. Details: identity 'Build\58bb64d7-d065-4522-94e2-a153b9fdadd6', scope 'repository'.
remote: TF401027: You need the Git 'GenericContribute' permission to perform this action. Details: identity 'Build\58bb64d7-d065-4522-94e2-a153b9fdadd6', scope 'repository'
fatal: unable to access 'https://our-correct-repo-address-on-dev.azure.com': The requested URL returned error: 403
Again, it works in the build pipeline, but not in the release pipeline.