stages:
- stage: checkout
jobs:
- job: checkout
steps:
- checkout: self
submodules: true
persistCredentials: true
然后,此尝试检查子模块,但以以下错误结尾:
Cloning into '/home/vsts/work/1/s/devops-scripting'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
fatal: clone of 'https://github.com/sourcerepo/devops-scripting.git' into submodule path '/home/vsts/work/1/s/devops-scripting' failed
它似乎是使用不正确的用户/密码的问题 - 如果我推动我可以简单地使用供应用户/通过参数,但是这似乎不起作用。
如何通过Azure管道更新子模块?从Azure Pipeline
检查git subsodule
确保用您的base64编码令牌替换“
git -c http.https://<url of submodule repository>.extraheader="AUTHORIZATION: basic <BASE64_ENCODED_TOKEN_DESCRIBED_ABOVE>" submodule update --init --recursive
<BASIC_AUTH_TOKEN>
使用项目中的秘密变量或构建管道来存储您生成的基本验证令牌。使用该变量在上述git命令中填充秘密。 其他解决方法,请使用自定义脚本重复使用访问令牌以进行subpodule同步:
steps:
- checkout: self
submodules: false
persistCredentials : true
- powershell: |
$header = "AUTHORIZATION: bearer $(System.AccessToken)"
git -c http.extraheader="$header" submodule sync
git -c http.extraheader="$header" submodule update --init --force --depth=1
选中更多信息,请参阅此帖子。
贝洛方法支持在同一阿多组织
中的不同阿多项目中检查子模型。请注意,所有子模型都必须在
Https!上
- script: |
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" \
submodule update --init --recursive
displayName: Fetch Submodules
steps:
- checkout: self
persistCredentials: true
this this Answer
i我假设由于子模块存储库的性质而产生的问题:如果它是私人存储库,则需要克隆凭证。
steps:
- checkout: self
submodules: true
persistCredentials : true
Project设置,2)SETTINGS。在那里,我禁用了选项:
在YAML Pipelines中保护对存储库的访问从YAML管道访问存储库时,请进行支票和批准。此外,生成一个示为YAML Pipeline中明确引用的存储库的作业访问令牌。
然后起作用