Search code examples
gitazureazure-devopsgit-submodules

Checkout Submodules in another Project in Azure DevOps Repository


I'm trying to checkout a submodule from another project in azure devops.

steps:

- checkout: self
  submodules: true
  persistCredentials: true
  clean: true

Checking out another repository in the same project works.

GOAL

Add as submodule REPOSITORY A in REPOSITORY B.

Projects

However i get the error:

Cloning into 'E:/build/Agent5/_work/16/s/.azuredevops'...
fatal: could not read Username for 'https://dev.azure.com': terminal prompts disabled
fatal: clone of 'https://dev.azure.com/ORGANIZATION/PROJECTA/_git/REPOSITORYA' into submodule path 'E:/build/Agent5/_work/16/s/.azuredevops' failed

How can i achieve this using YAML in Azure DevOps Repositories?


Solution

  • When adding a submodule i found out that the url in the .gitmodules were not correct.

    path = .azuredevops
    url = https://dev.azure.com/ORGANIZATION/PROJECTA/_git/REPOSITORYA
    

    Should be:

    path = .azuredevops
    url = https://ORGANIZATION@dev.azure.com/ORGANIZATION/PROJECTA/_git/REPOSITORYA