从Azure Pipeline,我正在尝试执行以下命令: 工作: - 工作:自动完成 DisplayName:“测试” 步骤: -bash:| azure_devops_ext_pat = $(system.accesstoken)az

问题描述 投票:0回答:1

,但是,当我执行此命令时,我会得到以下输出:

DEBUG: urllib3.connectionpool: https://dev.azure.com:443 "GET /myorganization/my-project/_git/my-repository/vsts/info HTTP/1.1" 404 157
DEBUG: msrest.exceptions: TF401019: The Git repository with name or identifier my-repository does not exist or you do not have permissions for the operation you are attempting.  Operation returned a 404 status code.
...
ERROR: cli.azure.cli.core.azclierror: TF401019: The Git repository with name or identifier my-repository does not exist or you do not have permissions for the operation you are attempting.  Operation returned a 404 status code.

这让我认为该构建帐户可能没有必要的许可。但是,如果我用卷发手动执行呼叫,我会得到适当的回复:

jobs:
- job: autocomplete
  displayName: "Test"
  steps:
  - bash: |
      curl -i https://[email protected]/myorganization/my-project/_git/my-repository/vsts/info -H "Authorization: Bearer $(System.AccessToken)"
      AZURE_DEVOPS_EXT_PAT=$(System.AccessToken) az repos list -o table --project my-project --debug
    displayName: 'Test repositories'

对于记录,我使用的是Azure CLI 2.70.0和Azure-Devops Extension 1.0.1,但是我尝试了多个版本以无效。

az repos list

above命令可能等于
azure-pipelines azure-cli azure-devops-extensions
1个回答
0
投票
DEBUG: urllib3.connectionpool: https://xxx.visualstudio.com:443 "GET /Test/_apis/git/repositories HTTP/1.1" 200 None
not

DEBUG: urllib3.connectionpool: https://xxx.visualstudio.com:443 "GET /Test/_git/test/vsts/info HTTP/1.1"
我只是在我这边测试,在项目许可中没有其他配置。效果很好
pool: vmImage: 'ubuntu-latest' steps: - bash: | curl -i https://dev.azure.com/wenbya/Test/_apis/git/repositories?api-version=7.1 -H "Authorization: Bearer $(System.AccessToken)" displayName: 'Test repositories 1' - bash: | az repos list -o table --project Test displayName: 'Test repositories 2' env: AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)

    

© www.soinside.com 2019 - 2025. All rights reserved.