Search code examples
gitazure-devopssonarqube

Git checkout failed with exit code: 1 in Azure DevOps


I have setup code in Azure DevOps Repository. I am using a self-hosted agent for pipelines. I have set up a pipeline to use Azure DevOps repository, but in the checkout, I'm getting below error.

I have tried by cleaning the work folder. Also, I have added "IgnoreCase=True" in specific work's config file.

##[debug]STDOUT/STDERR stream read finished.
##[debug]STDOUT/STDERR stream read finished.
##[debug]Finished process 14976 with exit code 1, and elapsed time 00:00:13.4575355.
##[error]Git checkout failed with exit code: 1
##[debug]Processed: ##vso[task.logissue type=error;]Git checkout failed with exit code: 1
##[debug]Processed: ##vso[task.complete result=Failed;]
##[debug]   at Agent.Plugins.Repository.GitSourceProvider.GetSourceAsync(AgentTaskPluginExecutionContext executionContext, RepositoryResource repository, CancellationToken cancellationToken)
   at Agent.Plugins.Repository.CheckoutTask.RunAsync(AgentTaskPluginExecutionContext executionContext, CancellationToken token)
   at Agent.PluginHost.Program.Main(String[] args)

I want checkout Azure DevOps Repository using a self-hosted agent.


Solution

  • at Agent.Plugins.Repository.GitSourceProvider.GetSourceAsync(AgentTaskPluginExecutionContext executionContext, RepositoryResource repository, CancellationToken cancellationToken)

    According to this error message, I check its corresponding source function code: GetSourceAsync. Then from comment I confirmed that this repos has submodule. So this issue caused by did not enable Checkout Submodule optional before build.

    According to the Checkout log shared privately:

    enter image description here

    The value of checkoutSubmodules is False, this is why the agent could not install the project which contain submodule, and throw the error message.

    To solve it, just go Get Source page, then enable the optional: Checkout submodules:

    enter image description here