DebugFactor.com | Forum

How to change the Git checkout `Time Out` value in Jenkins

I have configured a new Project Build in Jenkins with Git as the code source. The repository is a huge one with lots of branches and tags. The Jenkins build fails with this error.

 > git fetch --tags --force --progress -- https://github.<org>.com/<org>/project.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.<org>.com/<org>/project.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1004)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1245)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
	at hudson.scm.SCM.checkout(SCM.java:505)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1213)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:637)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:509)
	at hudson.model.Run.execute(Run.java:1888)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:99)
	at hudson.model.Executor.run(Executor.java:432)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -
...
...
Receiving objects:  47% (109819/230807), 1.23 GiB | 1.83 MiB/s
error: index-pack died of signal 15
fatal: index-pack failed

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2681)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2102)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:86)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:624)
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1002)
	... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

I think it is because since the source code is huge, it is taking more than 10 minutes to checkout, and it timeout by 10minutes.
How to change this default behavior?

To change the default timeout value in Jenkins for Git Checkout, navigate to the project configure page and under Source Code Management section for Git, click on AddAdvanced clone behaviours.

Set the time out value to your desired value.