Does Azure DevOps Git REST API support adding submodules?

208 Views Asked by At

I can't find any reference on this.

Is there support for calling their REST API to add a submodule?

1

There are 1 best solutions below

3
On BEST ANSWER

I cannot found related REST API to add submodules.

We can configure the submodules setting in the Checkout step of your pipeline if you want to download files from submodules. Sample code:

steps:
- checkout: self  # self represents the repo where the initial Pipelines YAML file was found
  clean: boolean  # whether to fetch clean each time
  fetchDepth: number  # the depth of commits to ask Git to fetch
  lfs: boolean  # whether to download Git-LFS files
  submodules: true | recursive  # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
  path: string  # path to check out source code, relative to the agent's build directory (e.g. \_work\1)
  persistCredentials: boolean  # set to 'true' to leave the OAuth token in the Git config after the initial fetch

Or we can use git command git submodule add {url} to Checkout submodules

Update1

We can install PowerShell module posh-git, then we could use git cmd in the power shell. You can refer to the doc posh-git and Setting up Git in PowerShell