This task will download git repository as an addition to default source. Consider this task as workaround where TFS build with git repository can only download 1 repository. Then this task will download another git repository required by your TFS build definition. This task assumes that git is already installed in PATH environment variable or %ProgramFiles%\Git within TFS build agent's machine.
URL of git repository. The repository should be public that can be downloaded without authentication. If it's the same location of main repository (specified in
Get sources/first task of the build), then it's automatically uses the same credential.
$(Build.Repository.GitUri) to refer relative URI for git URL, examples:
Full path to store the git repository. If not specified, then it will be located in $(Build.GitDirectory)\[repo name].
Branch/tag to checkout. By default, it will download single branch/tag and will checkout to that branch/tag automatically.
If this is true, it will remove previously downloaded repository and use
git clone command to download. Otherwise, it will stash everything and pull the remote branch/tag.
By default, this task expects public git repository that can be downloaded without authentication. But when the git repository is located in same TFS server, than it requires OAuth token for successful download. You can enable it in Options tab and check for Allow scripts to access OAuth token like screenshot below:
For YAML build, we need to expose the token to environment variable manually (named SYSTEM_ACCESSTOKEN) as follows:
- task: fakhrulhilal-maktum.GitDownloader.git-downloader.GitDownloader@0
displayName: Build Scripts
The git URL is considered the same TFS server when it's located in the same URL as TFS server (ignoring HTTP protocol). Supposed we have TFS public URL http://yourdomain/, so these URLs are considered the same TFS server:
And these are considered as different TFS server (means should be downloadable without authentication):
This extension relies on
$(System.TeamFoundationCollectionUri) variable to check for same server. To ensure which domain your TFS server is running on, try to create dummy build definition and create one PowerShell task containing this code: