azure-devops

Azure DevOps Pipeline trying to access Git: you do not have permissions error


I am working in Azure DevOps and have a Project called A with two repos R1 and R2. In addition, I have a pipeline, that is triggered when commiting to R1. R1 is a terraform repo, which references R2 such as

module "xxxx" {
  source      = "git::https://dev.azure.com/P/A/_git/R2/yyy"
}

In order to make that working, in our pipeline we run

  rm ~/.gitconfig |
  git config --global url."https://$(System.AccessToken)@dev.azure.com".insteadOf "https://dev.azure.com"

Also the Build Agent User has read access on all repos. However, we still get

remote: TF401019: The Git repository with name or identifier modules does │ not exist or you do not have permissions for the operation you are │ attempting.

Only when I disable the following option works: enter image description here

However, I would like to keep the option enabled.


Solution

  • do you explicitly indicate it in the resources?

    resources:
      repositories:
      - repository: R2
        type: git
        name: R2