我有一个Azure DevOps管道,它使用以下命令 checkout 两个存储库
resources:
repositories:
- repository: 'essentials'
type : 'git'
name : 'ic-essentials'
steps:
- checkout: self
persistCredentials: true
- checkout: 'essentials'
字符串
注意essentials
与self
不同。
稍后它在essentials
存储库中创建具有以下模板化流水线的文件,
parameters:
- name: SolutionName
type: string
displayName: 'Name of the Solution to be saved'
- name: Version
type: string
displayName: 'Semver version of the solution'
- name: CoreRepository
type: string
displayName: 'Name of the core repository'
steps:
- task: PowerShell@2
displayName: 'Setting git default'
inputs:
targetType: 'inline'
script: |
git config --global user.email $(Git.UserEmail)
git config --global user.name $(Git.UserName)
- task: PowerShell@2
displayName: 'Create manifest'
inputs:
targetType: 'inline'
script: |
Write-Host "Logic for manifest creation is loaded"
# A logic that creates a file in the following location
# $(Build.SourcesDirectory)/${{parameters.CoreRepository}}/Manifest
- task: PowerShell@2
displayName: 'Committing files and pushing'
inputs:
targetType: 'inline'
script: |
Set-Location -Path $(Build.SourcesDirectory)/${{parameters.CoreRepository}}
git push --set-upstream origin main
git add .
git commit -m "Committing the manifest file"
git push origin HEAD:main
型
我得到以下错误,
error: src refspec main does not match any
error: failed to push some refs to 'https://dev.azure.com/MyOrg/MyProj/_git/MyRepo'
[detached HEAD f327404] Committing the manifest file
1 file changed, 8 insertions(+)
create mode 100644 Manifest/THEFILE.manifest.xml
fatal: could not read Password for 'https://[email protected]': terminal prompts disabled
##[error]PowerShell exited with code '1'.
型
我可以证实
- 存储库存在。分支
main
也存在 - 文件肯定是在规定的位置创建的。
- 代理
My Project Build Service (My Org)
作为贡献者访问存储库。
我仍然认为这与代理对存储库的访问有关。我是否忽略了一些明显的东西?
2条答案
按热度按时间cs7cruho1#
基于此document,您可以测试下面的示例。
字符串
希望这对你有帮助。
djmepvbi2#
您可以使用一个小脚本来处理凭据:
字符串