Search code examples
azure-devopsazure-pipelinesazure-pipelines-build-taskazure-repos

Access Multi Repository in Azure DevOps Classic Pipeline


We are using Classic Azure DevOps Pipeline(Due to organization restriction). Normally we can use multiple repose in yaml during setup but same doesn't apply to Classic. I wanted to other repo in same project in my classic pipeline.

I got this Document from Microsoft for accessing additional repo Microsoft Document. I followed the same steps. Added script task with git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" Task and enabled oauth Oauth

Starting: Bash Script
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.214.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Script contents:
git clone -c http.extraheader="AUTHORIZATION: bearer ***" "https://[email protected]/Project/DevOps%20Integration%20Demo/_git/DevOps%20Integration%20Demo"
"C:\Program Files\Git\bin\bash.exe" -c pwd
/d/a/_temp
========================== Starting Command Output ===========================
"C:\Program Files\Git\bin\bash.exe" /d/a/_temp/d0ad30a0-9750-4561-9854-3bb4d4da9743.sh
Cloning into 'DevOps%20Integration%20Demo'...
remote: TF401019: The Git repository with name or identifier DevOps Integration Demo does not exist or you do not have permissions for the operation you are attempting.
fatal: repository 'https://dev.azure.com/Project/DevOps%20Integration%20Demo/_git/DevOps%20Integration%20Demo/' not found
##[error]Bash exited with code '128'.
Finishing: Bash Script

I get the error while running the pipeline. This Project is accessible and I am Project Administrator of the project. How to solve this issue


Solution

  • i fixed the issue using

    git clone https://:$env:[email protected]/MyOrg/MyProj/_git/MyRepoYou

    Need to Disable Protect access to repositories in YAML pipelines setting in project pipeline for cloning in classic Pipeline

    Setting