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

failure to clone repo on windows with git_ssh using plink

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • jenkins 1.609.2
      GIT client plugin 1.19.0
      GIT plugin 2.4.0

      jenkins fails to clone a remote repo on windows - and the issue is it is passing invalid arguments to git_ssh.

       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url git@github.com:jtnord/cjp-champagne-lib.git # timeout=10
      Cleaning workspace
       > git rev-parse --verify HEAD # timeout=10
      No valid HEAD. Skipping the resetting
       > git clean -fdx # timeout=10
      Fetching upstream changes from git@github.com:jtnord/cjp-champagne-lib.git
       > git --version # timeout=10
      using GIT_SSH to set credentials temp ssh key for jenkins
       > git -c core.askpass=true fetch --tags --progress git@github.com:jtnord/cjp-champagne-lib.git +refs/heads/*:refs/remotes/origin/*
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from git@github.com:jtnord/cjp-champagne-lib.git
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:763)
      	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1012)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$StepRunner.run(AbstractSynchronousNonBlockingStepExecution.java:75)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@github.com:jtnord/cjp-champagne-lib.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: plink: unknown option "-o"
      fatal: Could not read from remote repository.
      
      Please make sure you have the correct access rights
      and the repository exists.
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1388)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:62)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:313)
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:761)
      	... 11 more
      

      jenkins is run from the command line (java -jar .... as it is for testing purposes) on a windows machine.
      GIT_SSH is set in the windows environment to GIT_SSH=c:\Program Files (x86)\PuTTY\plink.exe

      The checkout is in a workflow which uses credentials (the following step)

      checkout([$class: 'GitSCM', branches: [[name: '*/functions_timestamp']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'cjp-champagne-lib']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'github', url: 'git@github.com:jtnord/cjp-champagne-lib.git']]])
      

          [JENKINS-30156] failure to clone repo on windows with git_ssh using plink

          Mark Waite added a comment - - edited

          Did this ever work for you? If so, at what version?

          Can you share what you gain by using plink in that case instead of using a credential stored in Jenkins?

          Mark Waite added a comment - - edited Did this ever work for you? If so, at what version? Can you share what you gain by using plink in that case instead of using a credential stored in Jenkins?

          James Nord added a comment -

          Did this ever work for you?

          this is a new setup and I've not normally pulled in git repos before - so no idea.

          Can you share what you gain by using plink...

          Useability!

          This is not a production Jenkins, this is my developer machine on which I run Jenkins locally for testing (as well as eclipse, mail etc etc). (java -jar jenkins.war, mvn hpi:run etc etc...) as such this inherits many of my user environment variables that I use for development (including GIT_SSH)

          As such using plink is what I use day_to_day and pagent stores my private keys and I access some servers with ssh with the same key that I use for git...

          ...in that case instead of using a credential stored in Jenkins?

          But this is using credentials in Jenkins...
          [[credentialsId: 'github'...
          moving the build from master (windows) to a bare linux VM then the git connection works (which requires a key) - so that proves to me that it is at least configured to use credentials correctly.

          James Nord added a comment - Did this ever work for you? this is a new setup and I've not normally pulled in git repos before - so no idea. Can you share what you gain by using plink... Useability! This is not a production Jenkins, this is my developer machine on which I run Jenkins locally for testing (as well as eclipse, mail etc etc). ( java -jar jenkins.war , mvn hpi:run etc etc...) as such this inherits many of my user environment variables that I use for development (including GIT_SSH ) As such using plink is what I use day_to_day and pagent stores my private keys and I access some servers with ssh with the same key that I use for git... ...in that case instead of using a credential stored in Jenkins? But this is using credentials in Jenkins... [[credentialsId: 'github'... moving the build from master (windows) to a bare linux VM then the git connection works (which requires a key) - so that proves to me that it is at least configured to use credentials correctly.

          Mark Waite added a comment -

          Thanks for the clarification. I like your use model very much. I blogged about the concept of personal continuous integration and then wrote an article for my company's journal on personal continuous integration.

          Mark Waite added a comment - Thanks for the clarification. I like your use model very much. I blogged about the concept of personal continuous integration and then wrote an article for my company's journal on personal continuous integration .

            Unassigned Unassigned
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: