Reputation: 385
Context: It is mentioned that Git Credential Managers or Personal Access Tokens is recommended to securely connect to Azure DevOps (SSH would shortly be disabled by security.). Our repository is very large and has a lot of history. Cloning a repository takes time, hence, using "Sync sources" in VSO Build Pipelines delays the pipeline by ~10 minutes. We wanted ability to download parts of source-code (vso git) during VSO build pipelines execution.
Ask: git archive could be used to download specific sub-folders of git repo directly from remote, without a full git clone. How can we download zip/tar from DevOps Git for specific subFolder without git clone & SSH protocol? How could we use the recommended PAT token/ AzureCredManager with git archive remote?
Refs:
git archive --remote="https://<repo>" <branch> <subFolder>
fatal: operation not supported by protocol
Upvotes: 1
Views: 1293
Reputation: 51143
Update:
Workaround: Disable the "Get sources" step and get only the source you want by manually executing the according git commands in a script. To do this either use - checkout: none in YAML pipeline or check don't sync source in get source step.
[
More details please kindly refer Shayki Abramczyk's excellent reply in this question: Checkout part of a branch in Azure DevOps Pipelines (GetSources)
For Azure DevOps Git repo, there is no way to specify part of files to be downloaded during Get source step in Azure DevOps Pipeline for now.
According to your description, seems your repo is too big or has too many binaries in it. Consider splitting it into smaller repos, or if it has a lot of binaries, using Git-LFS for binaries.
More details please refer this doc-- Manage and store large files in Git
Another workaround is using private agent.If the build is queued on private agent, is set Clean option as false in Get sources step.
After setting Clean option as false, it will download the changed files (instead of all the files) in Get sources step.
Upvotes: 1