Home > database >  Automatically push subtree changes to Azure repository
Automatically push subtree changes to Azure repository

Time:11-09

I am using Azure DevOps to work on two projects I'll name P1 and P2. P1 is a project containing some code I'd like to reuse in P2. I'd like to use Permissions

The only way I made it working is by providing an access token by replacing:

git push https://dev.azure.com/<organisation>/GitSubtreeProofOfConcept/_git/git-subtree-child

by

git push https://$(System.AccessToken)@dev.azure.com/<organisation>/GitSubtreeProofOfConcept/_git/git-subtree-child.


Even if I go this way, I still have ANOTHER error

/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/58591c72-da26-4758-9d24-6270bbc6a1e5.sh
release/AzurePipeline
1/1 (0) [0]
Created branch 'extract-child-subtree'
98b98c18804a186ffa5033c9caa39eaef14fbb6d
remote: TF401019: The Git repository with name or identifier git-subtree-child does not exist or you do not have permissions for the operation you are attempting.
fatal: repository 'https://dev.azure.com/<organisation>/GitSubtreeProofOfConcept/_git/git-subtree-child/' not found
Deleted branch extract-child-subtree (was 98b98c1).

But as you can see, the repository is present and has the branch I'm trying to push to (release/AzurePipeline, printed by the job itself).

Repositories

The Limit job authorization scope to current project for (non-)release pipelines flags have been unchecked as advised Settings

Thanks in advance for your help!

CodePudding user response:

From your description, there are two obvious problems.

1, Permission assignment error.

From your screenshot:

enter image description here

So in this situation, the 'Auth' identity is collection level(Organization level), but you are trying to assign permission to project level:

enter image description here

You should assign permission to this service account:

enter image description here

2,Repositories already been prevent from YAML pipelines' access.

You have disable the access from YAML pipeline to repositories:

enter image description here

But you were using YAML pipeline. In this situation, your pipeline will be unable to change the repo.

I notice the color of this setting is grey, you need to go to organization settings to change this.

  • Related