Cannot clone git from Azure DevOps using PAT

后端 未结 8 1754
礼貌的吻别
礼貌的吻别 2020-12-15 07:11

I cannot clone a simple repository from Azure DevOps. OS: Ubuntu 18.10

I do this:

  • Got to Azure DevOps
  • Click on the top right corner on my use
8条回答
  •  情话喂你
    2020-12-15 07:27

    Git http.extraheader & bearer

    YAML style Pipelines can use the preset variable System.AccessToken. After examining the formal 'Checkout ...' step at the beginning of the Pipeline I found this step to work in my script:

    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: 'git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" clone --depth 1 https://my-org@dev.azure.com/my-org/my-proj/_git/my-repo'
    

    Note that Azure DevOps job authorization scope may affect this

提交回复
热议问题