title: Git Clone in Jenkins with Personal Access Token idles forever
body: <p>We have an enterprise github running on a remote github server outside of our company network and need to use an https proxy to clone. We are not allowed to use password authentication, so either ssh (which is a no go due to proxy issues) or PAT.</p>
  
  <p>On my command line, the command</p>
  
  <pre><code>git clone https://user:token@github.exampleco.com/org/repo.git
  </code></pre>
  
  <p>clones the repository no problem, and it takes about 5-10 seconds.</p>
  
  <p>In Jenkins, the console output reads "cloning into directory-name" and then there's a spinning wheel that spins endlessly and this never resolves.</p>
  
  <p>I am running this inside an execute shell script as the github plugin runs some commands that apparently still want to do password authentication, even when I feed it the PAT version of the url with no credentials, and I don't see a PAT authorization option in the add credentials modal.</p>
  
  <p>To clarify the url given to the Jenkins plugin is:</p>
  
  <pre><code>https://user:token@github.exampleco.com/org/repo.git
  </code></pre>
  
  <p>and I get this sort of output:</p>
  
  <pre><code>No credentials specified
   &gt; git rev-parse --is-inside-work-tree # timeout=10
  Fetching changes from the remote Git repository
   &gt; git config remote.origin.url https://user:token@github.exampleco.com/org/repo.git # timeout=10
  Fetching upstream changes from https://user@github.exampleco.com/org/repo.git
   &gt; git --version # timeout=10
  Setting http proxy: corporateproxy.com:8080
   &gt; git fetch --tags --progress https://user@github.exampleco.com/org/repo.git +refs/heads/*:refs/remotes/origin/*
  ERROR: Error fetching remote repo 'origin'
  hudson.plugins.git.GitException: Failed to fetch from https://user@github.exampleco.com/org/repo.git
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:894)
      at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1161)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
      at hudson.scm.SCM.checkout(SCM.java:504)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
      at hudson.model.Run.execute(Run.java:1818)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:429)
  Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://user@github.exampleco.com/org/repo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
  stdout: 
  stderr: remote: Password authentication is not available for Git operations.
  remote: You must use a personal access token or SSH key.
  remote: See https://github.exampleco.com/settings/tokens or https://github.exampleco.com/settings/ssh
  fatal: unable to access 'https://user@github.exampleco.com/org/repo.git': The requested URL returned error: 403
  
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:892)
      ... 11 more
  ERROR: Error fetching remote repo 'origin'
  Finished: FAILURE
  </code></pre>
  
  <p>I do notice that the user:token@ is dropped in favor of simply user@ after the remote origin is configured. I tried running all of these commands manually in a shell and when I got to the second one, that is:</p>
  
  <pre><code>git fetch --tags --progress https://user:token@github.exampleco.com/org/repo.git
  </code></pre>
  
  <p>it also just idled forever like the clone command does.</p>