Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21030

Git CLI cannot clone with ssh protocol on Windows if Git is in non-default location

    Details

    • Similar Issues:

      Description

      The GIT_SSH fix for JENKINS-20356 only works if the Git program is installed in the default location on Windows. I had installed to a different location and had updated the PATH variable to find that non-default location. All the typical plugin operations worked, except this recently added code for JENKINS-20356 was not able to find ssh.exe.

      The message is misleading, since the issue is not that the plugin only supports official git client. The plugin could not find the ssh.exe program on the simple paths it checked. Unfortunately, it did not search the PATH, it only searched in the ProgramFiles directory, and I had installed to a different drive in order to save space on a small disc that was hosting ProgramFiles.

      Stack trace looks like this:

      Started by user anonymous
      Building remotely on alan-pc in workspace C:\J\workspace\JENKINS-20356
      Cloning the remote Git repository
      Cloning repository ssh://wheezy64b/var/cache/git/mwaite/bin.git
      Fetching upstream changes from ssh://wheezy64b/var/cache/git/mwaite/bin.git
      using GIT_SSH to set credentials Jenkins
      FATAL: git plugin only support official git client http://git-scm.com/download/win
      java.lang.RuntimeException: git plugin only support official git client http://git-scm.com/download/win
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createWindowsGitSSH(CliGitAPIImpl.java:1053)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:963)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:68)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:217)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:349)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:326)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at hudson.remoting.Engine$1$1.run(Engine.java:63)
      	at java.lang.Thread.run(Unknown Source)
      

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Wannes Sels
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
          http://jenkins-ci.org/commit/git-client-plugin/602d9055eceda6ed3596155a2b0ece9b3e17090a
          Log:
          [FIXED JENKINS-21030]
          look for ssh.exe next to known git.exe

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Wannes Sels Path: src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java http://jenkins-ci.org/commit/git-client-plugin/602d9055eceda6ed3596155a2b0ece9b3e17090a Log: [FIXED JENKINS-21030] look for ssh.exe next to known git.exe
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
          http://jenkins-ci.org/commit/git-client-plugin/fe2623a5192ee83715a369ca436583bbad3eeeed
          Log:
          Merge pull request #91 from wannessels/master

          [FIXED JENKINS-21030]

          Compare: https://github.com/jenkinsci/git-client-plugin/compare/2a1749a45817...fe2623a5192e

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java http://jenkins-ci.org/commit/git-client-plugin/fe2623a5192ee83715a369ca436583bbad3eeeed Log: Merge pull request #91 from wannessels/master [FIXED JENKINS-21030] Compare: https://github.com/jenkinsci/git-client-plugin/compare/2a1749a45817...fe2623a5192e
          Hide
          wannessels Wannes Sels added a comment - - edited

          I've created a pull request which should fix this.

          Additionally, you might run in to error messages like this:

          'c:\Program' is not recognized as an internal or external command,
          operable program or batch file.

          git-client creates temporary .bat files to pass credentials to ssh.exe, but msysgit doesn't like it if those .bat files are in a path with spaces.
          See msysgit issue 203.

          A workaround is to set the jenkins temp folder to a path without spaces. Add something like -Djava.io.tmpdir=C:\temp to your jenkins startup parameters.

          Show
          wannessels Wannes Sels added a comment - - edited I've created a pull request which should fix this. Additionally, you might run in to error messages like this: 'c:\Program' is not recognized as an internal or external command, operable program or batch file. git-client creates temporary .bat files to pass credentials to ssh.exe, but msysgit doesn't like it if those .bat files are in a path with spaces. See msysgit issue 203 . A workaround is to set the jenkins temp folder to a path without spaces. Add something like -Djava.io.tmpdir=C:\temp to your jenkins startup parameters.
          Hide
          markewaite Mark Waite added a comment -

          Confirmed fixed in git-client-plugin 1.6.2 and git-plugin 2.0.1

          Show
          markewaite Mark Waite added a comment - Confirmed fixed in git-client-plugin 1.6.2 and git-plugin 2.0.1

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              markewaite Mark Waite
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: