I created a Build pipeline in Azure using classic editor and selected empty job instead of using any template. This way provides option to connect only one repository at once. My requirement is to connect two repositories at once in the build pipeline and bring files from both of them to run some testing. There are so many templates available to chose from but I am not sure which is the right one to select, with which I can connect two repositories at the same time. I did Google for help and found that I could use Artifact with the combination of NuGet or nmp. I don't know how does that work.

  • 1
    Why do you have to do that at the build process? A release pipeline can consume multiple build artifacts and deploy them to the same location. Sep 12, 2019 at 0:35
  • 1
    I would like to run testing during the build pipeline. Sep 12, 2019 at 12:38

1 Answer 1


I also use the classic editor, and I have implemented this for our builds. My use case was that I have a set of common set of build/release scripts stored in their own repository, and I want the ability to bring them into the application builds that I am executing.

I created a custom Task Group with an Inline PowerShell script to do this:

# Reference: https://blog.rsuter.com/script-to-clone-all-git-repositories-from-your-vsts-collection/
Write-Host "Cloning MyRepo from Azure DevOps..."

Write-Host "Source directory: $sourcesDir"
$repoDir = Join-Path -Path "$sourcesDir" -ChildPath "MyRepo"
Write-Host "Target directory: $repoDir"

$url = "https://dev.azure.com/my_org/my_team_project/_git/MyRepo"

# Since using PAT, don't need real username, just non-empty username. Use "x".
$username = "x"
$pat = $env:PAT # passed into inline script as environment variable
$credentials = ("{0}:{1}" -f  $username, $pat)
$urlWithCreds = $url -Replace "://", ("://{0}@" -f $credentials)
Write-Host "Clone URL: $urlWithCreds"

git --version
git clone --progress $urlWithCreds
Set-Location "$repoDir"
git checkout master
git log -1 # show the latest commit

You will have to create a PAT with code permissions and pass it into the script as an environment variable. This task will clone the repository to a directory of the same name within your existing repo.

Putting it in a task group allows me to manage it in one place, and then all my more complicated build scripts can be under version control.

There is an active feature request for the capability to source from multiple repos. It looks like it is in the roadmap: https://developercommunity.visualstudio.com/idea/365522/allow-tfs-build-to-depend-on-multiple-repositories.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.