0

I got 2 projects within my Azure Organisation. I have created a pipeline from one repository which it's job is to promote code from one repo in the current project to another repo in a different project. I am using YAML and have built up the service connections

# Deploy to PREPROD
resources:
  repositories:
  - repository: target
    type: git
    name: 'Other Project/ThisRepo'

trigger:
  branches:
    include: [
      azure-pipelines
    ]

pool:
  name: 'My Pool'
  demands:
  - agent.computerName -equals MYPC

steps:
- checkout: self
  path: source
- checkout: target
  path: target

So on the GUI, it shows the target repo and I can browse to it. However when I run the pipeline, I get the following: -

remote: TF401019: The Git repository with name or identifier ThisRepo does not exist or you do not have permissions for the operation you are attempting. fatal: repository 'https://dev.azure.com/myOrg/Other%20Project/_git/ThisRepo/' not found

I can't figure out why it can't access it. I've seen in the docs about if I can access it then when the pipeline is created it should be given permission... I don't understand :/

TIA

Max Power
  • 350
  • 4
  • 15

1 Answers1

2

Please check if your <your project> Build Service accounts belongs to Project Collection Service Accounts on organization level.

I found similar issue solved here

Another option would be to add access only to particular repo to Build Service account from another project:

enter image description here

To do that go to:

  • Other Project
  • Settings
  • Repos -> Repositories
  • select ThisRepo
  • select Security tab and type name of the project which wants to use this repo and add Read permission
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • 1
    Thanks! I had tried adding the Build Service account to the other project previously to no avail, however it does work fine at the organisation level! Must be an MS bug as suggested in the link you posted. – Max Power May 13 '21 at 21:01