I’ve started using Jenkins to allow me to conveniently update and build this website on the go. In the process, I had to tweak a few settings, including timeouts, which proved more involved that expected.

The default Git timeout is 10 minutes; often too short, especially for repositories using git-lfs. While there are ways to adjust this for some steps using the UI, the only way to affect all of them is to change the Jenkins-wide environment variable.

On Ubuntu, you can set this by editing /etc/default/jenkins and updating the JAVA_ARGS value to include a define for org.jenkinsci.plugins.gitclient.Git.timeOut (specified in minutes) as follows:

JAVA_ARGS="-Djava.awt.headless=true -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=600"

You can verify your new settings have taken by checking the build’s console output. Commands are postfixed with a comment showing the timeout for each step. For example,

 > git config remote.origin.url git@github.com:jbmorley/jbmorley.co.uk.git # timeout=600

If you are running a setup with multiple slaves, you will need to perform this same configuration for each slave.