Azure DevOps Extension Git Repository Clone
Azure DevOps extension to clone additional Git repositories from Azure DevOps or GitHub and checkout a specific branch.
Parameters
V1
- Repository URL: Full Repository URL to clone. Should be in the same Azure DevOps organization.
- Repository Path: Full path to store the git repository. If empty then default working folder.
- Branch: Branch to checkout (or pull).
- Clean: If ticked then (delete and) clone, else pull latest changes.
- Depth: Create a shallow clone with a history truncated to the specified number of commits. Leave empty for full clone.
V2
V2 includes all V1 parameters plus the following additional parameters:
- Repository Type: Select between Azure DevOps or GitHub repositories.
- GitHub Personal Access Token: Required for private GitHub repositories. For public GitHub repos, this is optional.
- Fallback Branch: Branch to checkout (or pull) if initial Branch fails.
- Base Branch: Branch to checkout (or pull) if fallback Branch fails.
Requirements
For Azure DevOps Repositories:
- Only for an additional Git repository in the same Azure DevOps organization.
- Pipeline Agent version greater than 1.95.1
- "Allow scripts to access the OAuth token" box ticked in the Agent job (Run on agent) settings.
- Agent machine should have Git installed in PATH environment variable or at %ProgramFiles%\Git (Azure Pipelines Agents work!).
For GitHub Repositories:
- Pipeline Agent version greater than 1.95.1
- Agent machine should have Git installed in PATH environment variable or at %ProgramFiles%\Git (Azure Pipelines Agents work!).
- For private repositories: GitHub Personal Access Token (PAT) with 'repo' scope.
- For public repositories: No authentication required (PAT is optional).
Usage Examples
Azure DevOps Repository
- Set Repository Type to "Azure DevOps"
- Enter the full Azure DevOps repository URL
- Ensure "Allow scripts to access the OAuth token" is enabled in agent job settings
- Specify branch, path, and other options as needed
GitHub Repository (Public)
- Set Repository Type to "GitHub"
- Enter the full GitHub repository URL (e.g., https://github.com/owner/repo.git)
- Leave GitHub PAT empty for public repositories
- Specify branch, path, and other options as needed
GitHub Repository (Private)
- Set Repository Type to "GitHub"
- Enter the full GitHub repository URL (e.g., https://github.com/owner/repo.git)
- Create a GitHub Personal Access Token with 'repo' scope
- Store the PAT as a secret variable in your pipeline
- Reference the secret variable in the GitHub PAT field (e.g., $(GitHubPAT))
- Specify branch, path, and other options as needed
Inspired on an existing extension created by Fakhrulhilal Maktum: https://marketplace.visualstudio.com/items?itemName=fakhrulhilal-maktum.GitDownloader
Privacy policy: https://github.com/Febiunz/AzureDevOpsExtensionGitClone/blob/master/PRIVACY.md
| |