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

5

12

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

Cyte answered 20/1, 2022 at 5:22 Comment(1)
I got this issue because of updating the name of my repository. I fixed it by simply setting up the url of the repository on my project again: git remote set-url origin repository-urlPromulgate
M
12

As you mention in your update, the project consuming the Repo needs to have the setting Limit job authorization scope to current project for non-release pipelines disabled in the Project Settings.

NOTE: Please bear in mind that this changes the build identity to collection-scoped. This could cause issues with using Auzure DevOps Artifacts. See Scoped build identities.

Azure DevOps Project Pipeline Settings

Massey answered 8/11, 2022 at 15:59 Comment(2)
What if this is already disabled and still getting the same error?Propitious
It solved my issue, thanks a lot!Frentz
P
9

You may also need to add the proper Build Service account into the Contributors of the upstream repo.

See (https://cloudopszone.com/azure-devops-how-to-solve-remote-tf401019-the-git-repository-with-name-or-identifier/).

In other words, go to the upstream project -> Settings (gear icon) -> Permissions -> Contributors -> Members and then Add the appropriate 'XXX Build Service (yyy)'.

Ploy answered 2/2, 2023 at 14:10 Comment(4)
This solution worked for me when the other settings for limiting were already disabled and the Repository Security had no restrictionsPloy
This is the less permissive and RIGHT way of doing ! good, you read the docs! instead the precedent answers set too WIDE permissions, also the devops administrators could deny touching the "Limit job bla bla...." so prefer adding "XXX Build Service (yyy)" NOTE : you can use the Read Group instead of ContributorsOctet
@matteoOreficeIT What adding the build service doesn't work?Milner
This is the solution! Especially you have different build services in different projects.Cameron
S
5

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.

Sulphonamide answered 16/6, 2022 at 15:43 Comment(1)
It's greyed out when you don't have permissions to make these changes to the project. I believe that you need to be a Project Administrator .Massey
C
2

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.

Cimbura answered 9/5, 2022 at 18:34 Comment(0)
B
1

I found a very helpful troubleshooting guide here.

In my case, I needed to have do two things in order to check out a repo cross another project.

  1. Configure permissions for a project to access another project in the same project collection.
  2. Configure permissions to access another repo in the same project collection.

Hope it helps!

Brevier answered 29/5, 2023 at 1:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.