Clone an Azure repository into the workspace directory.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| token | string | - | |
| branch | string | - | |
| remoteUrl | string | - | |
| cloneDepth | number | - | |
| targetPath | string | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| cloneFullPath | string | - |
Usage Examples
Clone the default branch into a vendor directory
Clone a public Azure DevOps repository into a subdirectory under the workspace. Use this after fetching your base template with fetch:template to bring in shared code.
steps:
- id: cloneSharedLibs
action: azure:repository:clone
input:
remoteUrl: https://dev.azure.com/contoso/Platform/_git/shared-libraries
targetPath: vendor/shared-librariesShallow clone a specific branch for faster builds
Clone only the latest commit from a non-default branch to reduce clone time and workspace size. Use when you only need current sources for a build or code generation step.
steps:
- id: cloneClientSdk
action: azure:repository:clone
input:
remoteUrl: https://dev.azure.com/contoso/Payments/_git/client-sdk
branch: develop
cloneDepth: 1
targetPath: src/vendor/client-sdkClone a private repository using a token
Clone a private Azure DevOps repository by passing a token from template parameters. Use when the integration does not provide credentials and you need explicit authentication.
steps:
- id: clonePrivateInfra
action: azure:repository:clone
input:
remoteUrl: https://dev.azure.com/contoso/Infra/_git/deployment-scripts
branch: main
targetPath: tools/deployment-scripts
token: ${{ parameters.azurePat }}Build the remote URL from parameters
Construct the remote URL dynamically from user input and clone into a path that uses the repository name. Use this pattern when targeting different orgs/projects/repos from a single template.
steps:
- id: cloneDynamicRepo
action: azure:repository:clone
input:
remoteUrl: https://dev.azure.com/${{ parameters.azureOrg }}/${{ parameters.project }}/_git/${{ parameters.repoName }}
branch: release/2025.10
targetPath: deps/${{ parameters.repoName }}Clone with extended history for tooling that needs commits
Clone a repository with deeper history to support tools that read commit metadata, then work from a stable branch. Use when generating changelogs or computing diffs.
steps:
- id: cloneWithHistory
action: azure:repository:clone
input:
remoteUrl: https://dev.azure.com/contoso/Platform/_git/service-template
branch: main
cloneDepth: 50
targetPath: .cache/service-template