title: Jenkins git checkout on agent not working
body: <p>The Jenkins file in my github repository is used in a Jenkins Master/Slave environment.
  I need to execute a testing command on a remote Jenkins Slave Server.
  In my declarative pipeline the agent is called like this:</p>
  
  <pre><code>stage("Testautomation") {
    agent { label 'test-device' }
      steps {
          bat '''
          @ECHO ON
          ECHO %WORKSPACE%
          ... '''
      }
  }
  </code></pre>
  
  <p>Before Jenkins can even execute a remote command, it starts checking out from version control. The checkout on Jenkins Master is no problem and working fine. But on this Jenkins Slave I always receive this error message.</p>
  
  <pre><code>using credential github-enterprise:...
   &gt; git rev-parse --is-inside-work-tree # timeout=10
  Fetching changes from the remote Git repository
   &gt; git config remote.origin.url https://...git # timeout=10
  Fetching upstream changes from https://...git
   &gt; git --version # timeout=10
  using GIT_ASKPASS to set credentials GitHub Enterprise Access Token
   &gt; git fetch --tags --force --progress --depth=1 -- https://...git +refs/heads/development:refs/remotes/origin/development # timeout=120
  Checking out Revision ... (development)
   &gt; git config core.sparsecheckout # timeout=10
   &gt; git checkout -f ...
  Could not checkout ...
  </code></pre>