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

Warn that space in TEMP or TMP causes msysgit ssh credentials failure

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      git 2.2.1, git-client 1.8.0, windows server 2008 R2 64bit
    • Similar Issues:

      Description

      Trying to switch from HTTPS to SSH. Getting the following exception after switching (changed the link for this post):

      Fetching upstream changes from git@server:username/repository.git
      using GIT_SSH to set credentials server ssh
      FATAL: Failed to fetch from git@server:username/repository.git
      hudson.plugins.git.GitException: Failed to fetch from git@server:username/repository.git
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:623)
      at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:855)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:880)
      at org.jenkinsci.plugins.multiplescms.MultiSCM.checkout(MultiSCM.java:118)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1251)
      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:605)
      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
      at hudson.model.Run.execute(Run.java:1703)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:231)
      Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@server:username/repository.git +refs/heads/master:refs/remotes/origin/master" returned status code 128:
      stdout:
      stderr: 'C:\Program' is not recognized as an internal or external command,
      operable program or batch file.
      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:1276)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1146)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:87)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:254)
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:621)
      ... 11 more

        Attachments

          Activity

          Hide
          nitroinside Hugo Meneses added a comment -

          In my case the error happened because Apache Temp Dir was setted to Program Files (x86). So, the solution for me was replace in Java args for Tomcat:

          -Djava.io.tmpdir=C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\temp
          

          To:

          -Djava.io.tmpdir=C:\Windows\Temp
          
          Show
          nitroinside Hugo Meneses added a comment - In my case the error happened because Apache Temp Dir was setted to Program Files (x86). So, the solution for me was replace in Java args for Tomcat: -Djava.io.tmpdir=C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\temp To: -Djava.io.tmpdir=C:\Windows\Temp
          Hide
          markewaite Mark Waite added a comment -

          Hugo Meneses did the newly added warning actually appear in your case? If the change was only to the value of java.io.tmpdir, I would expect it to not appear, since the warning message is displayed for environment variables with spaces in their value, not for Java properties with spaces in the value.

          Though, I guess the Java virtual machine must be communicating the value of java.io.tmpdir to the git subprocess somehow, and that communication is probably through environment variables.

          Show
          markewaite Mark Waite added a comment - Hugo Meneses did the newly added warning actually appear in your case? If the change was only to the value of java.io.tmpdir, I would expect it to not appear, since the warning message is displayed for environment variables with spaces in their value, not for Java properties with spaces in the value. Though, I guess the Java virtual machine must be communicating the value of java.io.tmpdir to the git subprocess somehow, and that communication is probably through environment variables.
          Hide
          nitroinside Hugo Meneses added a comment - - edited

          Mark Waite no, the warning didn't appear, just failed when executing fetch command as the description in this issue. I think it must be a buggy parsing of the argument or something like that (I haven't seen the code), because in a previous version of the plugin with the same TEMP variable the error didn't occured.

          Also, I tried to set a environment variable in Jenkins configuration:

          Name=TEMP
          Value=C:\Windows\Temp
          

          But was ignored and the error still. I assume that code takes the virtual machine's value instead the configuration's.

          Show
          nitroinside Hugo Meneses added a comment - - edited Mark Waite no, the warning didn't appear, just failed when executing fetch command as the description in this issue. I think it must be a buggy parsing of the argument or something like that (I haven't seen the code), because in a previous version of the plugin with the same TEMP variable the error didn't occured. Also, I tried to set a environment variable in Jenkins configuration: Name=TEMP Value=C:\Windows\Temp But was ignored and the error still. I assume that code takes the virtual machine's value instead the configuration's.
          Hide
          markewaite Mark Waite added a comment -

          Hugo Meneses as far as I could tell from my reviews of the code, the problem was not in the plugin, but in the git command line implementation.

          There have been changes to the usage of the git command line calls, in particular because the git plugin now allows use of the Jenkins credentials plugin, while the original versions of the plugin did not support credential management from within Jenkins.

          If you find a case in the source code where you think a mistake is being made, pull requests are certainly welcomed.

          Show
          markewaite Mark Waite added a comment - Hugo Meneses as far as I could tell from my reviews of the code, the problem was not in the plugin, but in the git command line implementation. There have been changes to the usage of the git command line calls, in particular because the git plugin now allows use of the Jenkins credentials plugin, while the original versions of the plugin did not support credential management from within Jenkins. If you find a case in the source code where you think a mistake is being made, pull requests are certainly welcomed.
          Hide
          nitroinside Hugo Meneses added a comment -

          Mark Waite thanks for the quick answer! I guess you're right, probably is because the command line calls.

          Show
          nitroinside Hugo Meneses added a comment - Mark Waite thanks for the quick answer! I guess you're right, probably is because the command line calls.

            People

            • Assignee:
              markewaite Mark Waite
              Reporter:
              flaviodonze Flavio Donzé
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: