It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

timeout error when accesing stash from jenkins

EnvInject] - Loading node environment variables.
Building remotely on jxlprdbld01 (reports snapshot admin compile junit distributions) in workspace /opt/reference/deployments/integration/QAP/availity-web
 > git rev-parse --is-inside-work-tree
Fetching changes from the remote Git repository
 > git config remote.integration.url ssh://
Fetching upstream changes from ssh://
 > git --version
 > git fetch --tags --progress ssh:// +refs/heads/*:refs/remotes/integration/*
ERROR: Timeout after 10 minutes
FATAL: Failed to fetch from ssh://
hudson.plugins.git.GitException: Failed to fetch from ssh://
	at hudson.plugins.git.GitSCM.fetchFrom(
	at hudson.plugins.git.GitSCM.retrieveChanges(
	at hudson.plugins.git.GitSCM.checkout(
	at hudson.model.AbstractProject.checkout(
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
	at jenkins.scm.SCMCheckoutStrategy.checkout(
	at hudson.model.AbstractBuild$
	at hudson.model.Run.execute(
	at hudson.model.ResourceController.execute(
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress ssh:// +refs/heads/*:refs/remotes/integration/*" returned status code 143:
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$
	at hudson.remoting.UserRequest.perform(
	at hudson.remoting.UserRequest.perform(
	at hudson.remoting.Request$
	at hudson.remoting.InterceptingExecutorService$
	at java.util.concurrent.FutureTask$Sync.innerRun(
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
	at java.util.concurrent.ThreadPoolExecutor$

4 answers

0 votes
Jeff Thomas Atlassian Team Aug 01, 2014


The timeout appears to be coming from the Git command below:

git fetch --tags --progress ssh:// +refs/heads/*:refs/remotes/integration/*

Could you try running that command manually on the server to see how long it's taking? You can find the exact time with:

time git fetch --tags --progress ssh:// +refs/heads/*:refs/remotes/integration/*

By default, the Git client plugin for Jenkins has a 10 minute timeout set for Git operations. When Git Plugin 2.3 is released, this can be configured in the settings. Until then, it can be increased by changing the system property:

java -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=120 -jar jenkins.war

Hi Jeff, Can you please let me know where do we change the system property and run the script that you have given?

Hi Aditya,

copy your ssh keys inside $HOME/.ssh

Hope it has helped.

Gontran. S

Is there any solution that helped you to by-pass this error? If so please help me.

Sadly, I have run across this error, as well.  No resolution?

I did time the command, and it only took 3.5 minutes.  Also, I increased the timeout some time ago, so I am now consistently seeing this with a 60 minute timeout.  Any other ideas what may be causing this?

One note, the jenkins job does build several configurations at once (matrix job).  Could this be affecting the ability to fetch, and why I don't see it when I clone directly on the machine?

Aha!  I finally realized that the jenkins service wasn't running as who I thought it was.  E.g. I missed a step to change the login of the jenkins service to the expected user whose ssh keys had been added to Stash.

So, the lesson I learned is, if Jenkins times out trying to connect to Stash:

  1. Verify that Jenkins is running as the user you expect by checking Jenkin's node system information (
  2. Verify that ssh is properly setup for that user, on the node, by logging in and performing the clone.  You might need to add the ssh key to Stash, or fix the ssh setup.
  3. Time the above clone operation to ensure the timeout is set appropriately.



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

4,083 views 4 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you