Why is Jenkins failing when fetching from git, while the command line isn't? Why is Jenkins failing when fetching from git, while the command line isn't? jenkins jenkins

Why is Jenkins failing when fetching from git, while the command line isn't?


I had this problem as well and was only able to solve it by deleting the workspace of the problematic repository on our master Jenkins server.

I think the problem was that there was a connection-error (like @gbjbaanb said) in a few of the builds (our Bitbucket crashed). This left the workspace on master in a corrupt state, and because Jenkins tries to use cached workspaces where it can, this caused every following build to fail as well.


enter image description here1) Go to job configuration

2) Go to the "Source Code Management" section

3) Additional behaviors > add

4) Select "Wipe out repository and force clone"

This will delete and re-clone only the workspace which is for your job. If you'd like to confirm before deleting, then I suggest echoing out the $WORKSPACE variable via a batch/bash command build step.

Also, this makes the build much slower, so I suggest removing it after one build.


For me, this was hitting the 10 minute default timeout for the git-client plugin.

Solved by setting an advanced clone behaviour on the job and upping the timeout.

In the job configuration page under the Git plugin section, there is a drop-down list "Add". Within that dropdown list there is a selection "Advanced clone behaviours". When you add the advanced clone behaviors, you'll see a field for "Timeout (in minutes) for clone and fetch operation".

If you add additional behaviours before the operation you can up the timeout for clone and checkout - which has translated to a higher timeout value in my console

  • Advanced Checkout behaviours
  • Advanced Clone behaviours

Putting any value in timeout overrides the default.

Knowledge gained from JENKINS-20445.