使用 Azure 管道访问同一项目中的多个 azure git 存储库

Tus*_*har 2 azure azure-devops azure-pipelines

我在项目中有两个 Azure git 存储库。我需要在单个管道中访问两个存储库。我用我的管道映射了一个存储库。

根据文件:https : //docs.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=yaml#authorize-access-to-your-repositories

我在管道中使用命令-script: git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" <clone URL>来访问另一个存储库

: Mapping values are not allowed in this context."由于冒号而出现异常(授权:)

所以试着逃避冒号 -script: git clone -c http.extraheader="AUTHORIZATION':' bearer $(System.AccessToken)" <clone URL>

但有错误 Cloning into 'XXXX'... fatal: unable to access <repository url>'

我可以在本地克隆这个存储库。

Lev*_*SFT 5

试试下面的脚本,在 yaml 中使用文字块“ | ”。不要将 git 命令与-script,放在同一行

- script: |
    git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" <repository url>
Run Code Online (Sandbox Code Playgroud)