title: Jenkins fail to clone from Gitlab because timeout
body: <p>I faced error when I try to build my Gitlab project in Jenkins.</p>
  
  <h2>What I tried</h2>
  
  <ol>
  <li>Set the system environment as <a href="https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin" rel="nofollow">Setup your environment variables for
  Git Plugin Jenkins</a></li>
  <li>Under “git” change “Path to Git executable” to
  GIT_FOLDER\cmd\git.cmd (NOT GIT_FOLDER\bin\git.exe)</li>
  <li><p>Using PsExec.exe to let the “Local System account” accessed by
  Jenkins server to have SSH keys or known_hosts set up and verify via</p>
  
  <blockquote>
    <p>"GIT_FOLDER\bin\ssh.exe" -T git@your.git.server</p>
  </blockquote></li>
  <li><p>Even success to fetch via the same command in the </p>
  
  <blockquote>
    <p>"C:\Program Files (x86)\Git\bin\sh.exe" -login -i window</p>
  </blockquote></li>
  <li><p>Fill in the Gitlab host url and API Token for Jenkins account in
  Gitlab server</p></li>
  <li>Create credential with ssh key with no passphrase and selected in
  project credential</li>
  </ol>
  
  <h2>Jenkins Build Error Log</h2>
  
  <p>(git_repository.git represents my git repository url)</p>
  
  <p>Started by user Jenkins</p>
  
  <p>Building in workspace C:\Program Files (x86)\Jenkins\jobs\MyApp-Test\workspace</p>
  
  <blockquote>
    <p>C:\Program Files (x86)\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10</p>
  </blockquote>
  
  <p>Fetching changes from the remote Git repository</p>
  
  <blockquote>
    <p>C:\Program Files (x86)\Git\bin\git.exe config remote.origin.url git_repository.git # timeout=10</p>
  </blockquote>
  
  <p>Fetching upstream changes from git_repository.git</p>
  
  <blockquote>
    <p>C:\Program Files (x86)\Git\bin\git.exe --version # timeout=10</p>
  </blockquote>
  
  <p>using GIT_SSH to set credentials </p>
  
  <blockquote>
    <p>C:\Program Files (x86)\Git\bin\git.exe -c core.askpass=true fetch --tags --progress git_repository.git +refs/heads/<em>:refs/remotes/origin/</em></p>
  </blockquote>
  
  <pre><code>ERROR: Timeout after 10 minutes
  ERROR: Error fetching remote repo 'origin'
  hudson.plugins.git.GitException: Failed to fetch from git_repository.git
  at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:735)
  at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:983)
  at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1016)
  at hudson.scm.SCM.checkout(SCM.java:485)
  at hudson.model.AbstractProject.checkout(AbstractProject.java:1282)
  at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
  at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
  at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
  at hudson.model.Run.execute(Run.java:1741)
  at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
  at hudson.model.ResourceController.execute(ResourceController.java:98)
  at hudson.model.Executor.run(Executor.java:381)
  Caused by: hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\bin\git.exe -c core.askpass=true fetch --tags --progress git_repository.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
  stdout: 
  stderr: 
  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1591)
  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1379)
  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:86)
  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:324)
  at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:733)
  ... 11 more
  ERROR: Error fetching remote repo 'origin'
  </code></pre>