Reputation: 273
I have two Azure git repository within project. I need to access both repository in single pipeline. I mapped one repository with my pipeline.
As per document: https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=yaml#authorize-access-to-your-repositories
I am using command in pipeline -script: git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" <clone URL>
to access another repository
got exception : Mapping values are not allowed in this context."
due to colon (AUTHORIZATION:)
So tried escaping colon -script: git clone -c http.extraheader="AUTHORIZATION':' bearer $(System.AccessToken)" <clone URL>
but got error
Cloning into 'XXXX'...
fatal: unable to access <repository url>'
I can clone this repository on local.
Upvotes: 2
Views: 1235
Reputation: 30373
Try below scripts,using literal blocks in yaml "|". Donot put the git command at the same line with -script
,
- script: |
git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" <repository url>
Upvotes: 6