gpt4 book ai didi

azure - 无法读取 'Repository URL' : terminal prompts disabled 的密码

转载 作者:行者123 更新时间:2023-12-02 07:38:36 25 4
gpt4 key购买 nike

我正在 Azure DevOps Pipeline 中执行一个批处理文件,其中包含以下语句。

git init    
git checkout -b %BranchName%
git remote add origin %RepoURL%
git fetch && git checkout %BranchName%

参数从变量中获取值。但我收到以下错误。

"Could not read Password for '<Repository URL>': terminal prompts disabled"

我尝试按如下方式设置 RepoURL 参数的值。

https://<CollectionName>@dev.azure.com/<CollectionName>/<ProjectName>/_git/<RepoName>
https://<PAT>@dev.azure.com/<CollectionName>/<ProjectName>/_git/<RepoName>

此论坛中的许多帖子建议使用 PAT。于是尝试了如下的 git pull 语句。

git pull %RepoURL%

但运气不佳。仍然遇到同样的错误。请任何人告诉我如何解决这个问题。

谢谢。

最佳答案

根据您的描述,我使用以下方法进行测试,效果良好。

https://{PAT}@dev.azure.com/{organization}/{project}/_git/{repo name}

为了解决此问题,请检查以下事项:

1.在代理作业选项中启用“允许脚本访问 OAuth token ”。 enter image description here

在 git 远程添加源 %RepoURL% 中使用System.AccessToken:

git remote add origin %RepoURL%    

RepoURL: https://$env:SYSTEM_ACCE<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f7a4a4a3b8bcb2b9b7939281d9968d828592d994989a" rel="noreferrer noopener nofollow">[email protected]</a>/{organization}/{project}/_git/{repo name}
  • 转到“项目设置”->“存储库”下的“存储库”,向构建用户授予权限(在存储库设置中)。 enter image description here
  • 关于azure - 无法读取 'Repository URL' : terminal prompts disabled 的密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65023500/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com