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

Viewed 5139

I have two ADO repositories named private2 and public2. private2 references public2 as a submodule:

enter image description here

I also added a yaml file (vsts-cicd.yml) for build as follows:

resources:
  repositories:
  - repository: test
    type: git
    name: <ProjectName>/public2
    ref: master

stages:

- template: build1.yml@test
  parameters:
    repoToCheckout: test
    checkoutPath: '$(Build.BuildNumber)'

- template: build2.yml@test
  parameters:
    repoToCheckout: test
    checkoutPath: '$(Build.BuildNumber)'
    
- template: yaml/build3.yml

On running the build, I see the first two templates completed successfully. On reaching - template: yaml/build3.yml it fails with the following error:

enter image description here

What am I missing?

UPDATE:

I followed this article (https://www.timschaeps.be/post/dealing-with-error-tf401019-submodules-azure-pipelines/) to fix the issue however I don’t see this option in project settings: ‘Limit job authorization scope to referenced Azure DevOps repositories’. What am I missing?

enter image description here

2 Answers

I dont know why its greyed out but I think you need to also disable "Protect access to repositories in YAML pipelines". Worked for me.

I've faced this issue recently. For me it was using wrong credentials from windows credential manager. Permission on my repository was revoked for the credentials stored. So I removed the obsolete credential and cloned again. It worked for me.

Related