Azure devops错误:Git检出失败,退出代码:1

时间:2020-02-04 07:20:29

标签: git azure github azure-devops azure-repos

我已经将代码从本地计算机推送到了天蓝色的存储库。在推动代码时,那个时候头指向Master分支。没关系之后,我创建了发行​​版并发现“ git checkout错误”。我检查了代理计算机,在这里可以看到它指向特定的提交而不是分支。我该如何解决这个问题?

在此处查看日志,

2020-02-04T07:34:23.2688328Z You are in 'detached HEAD' state. You can look around, make experimental
2020-02-04T07:34:23.2688360Z changes and commit them, and you can discard any commits you make in this
2020-02-04T07:34:23.2688390Z state without impacting any branches by performing another checkout.
2020-02-04T07:34:23.2688437Z 
2020-02-04T07:34:23.2688466Z If you want to create a new branch to retain commits you create, you may
2020-02-04T07:34:23.2688496Z do so (now or later) by using -b with the checkout command again. Example:
2020-02-04T07:34:23.2688518Z 
2020-02-04T07:34:23.2688565Z   git checkout -b <new-branch-name>
2020-02-04T07:34:23.2688588Z 
2020-02-04T07:34:23.2688616Z HEAD is now at 5c95b07 Added samplefile
2020-02-04T07:34:23.3208965Z An error occurred during download: System.InvalidOperationException: Git checkout failed with exit code: 1
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.GitSourceProvider.GetSourceAsync(IExecutionContext executionContext, ServiceEndpoint endpoint, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.Artifacts.TfsGitArtifact.DownloadAsync(IExecutionContext executionContext, ArtifactDefinition artifactDefinition, String downloadFolderPath)
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.<>c__DisplayClass39_2.<<DownloadArtifacts>b__2>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.RetryExecutor.ExecuteAsync(Func`1 action)
2020-02-04T07:34:23.3209166Z Retrying download...
2020-02-04T07:34:23.3211433Z Ensuring artifact folder C:\agent\vsts-agent-win-x64-2.163.1\_work\r2\a\_JHipsterDemoRepo exists and is clean.
2020-02-04T07:34:26.6696074Z Syncing repository: 3290da05-8551-4d0f-a00c-037d882d4835 (Git)
2020-02-04T07:34:26.6699057Z Prepending Path environment variable with directory containing 'git.exe'.
2020-02-04T07:34:26.6700464Z ##[command]git version
2020-02-04T07:34:26.6934186Z git version 2.21.0.windows.1
2020-02-04T07:34:26.6962266Z ##[command]git init "C:\agent\vsts-agent-win-x64-2.163.1\_work\r2\a\_JHipsterDemoRepo"
2020-02-04T07:34:26.7597056Z Initialized empty Git repository in C:/agent/vsts-agent-win-x64-2.163.1/_work/r2/a/_JHipsterDemoRepo/.git/
2020-02-04T07:34:26.7621586Z ##[command]git remote add origin https://218316@dev.azure.com/218316/CITS-Insights%20POC/_git/JHipsterDemoRepo
2020-02-04T07:34:26.7846491Z ##[command]git config gc.auto 0
2020-02-04T07:34:26.8167913Z ##[command]git config --get-all http.https://218316@dev.azure.com/218316/CITS-Insights%20POC/_git/JHipsterDemoRepo.extraheader
2020-02-04T07:34:26.8372843Z ##[command]git config --get-all http.proxy
2020-02-04T07:34:26.8590568Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ***" fetch --tags --prune --progress --no-recurse-submodules origin
2020-02-04T07:34:26.9953230Z remote: Azure Repos        
2020-02-04T07:34:26.9953340Z remote: We noticed you're using an older version of Git. For the best experience, upgrade to a newer version.

1 个答案:

答案 0 :(得分:0)

Azure devops错误:Git结帐失败,退出代码:1

根据错误日志:

Microsoft.VisualStudio.Services.Agent.Worker.Build.GitSourceProvider.GetSourceAsync

然后,我检查相应的源功能代码:GetSourceAsync。看来您的存储库具有子模块,所以此问题可能是由于在构建之前未启用Checkout Submodule可选项引起的。

checkoutSubmodules的默认值为False

要解决此问题,请尝试转到Add an artifact页,然后启用可选的Checkout submodules

enter image description here

希望这会有所帮助。