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

Git plugin fails with NullPointerException (Error trying to determine the git version: Error performing command: --version)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      git version 1.7.9.5
      git plugin version 1.1.26
      jenkins version 1.500

      Description

      Suddenly, the git plugin stopped to work. It issues the following error message:

      Error trying to determine the git version: Error performing command: --version

      Full stack trace:

      ERROR: Error cloning remote repo 'origin' : Could not clone ssh://<URL>
      hudson.plugins.git.GitException: Could not clone ssh://<URL>
      	at hudson.plugins.git.GitAPI.clone(GitAPI.java:273)
      	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1044)
      	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:986)
      	at hudson.FilePath.act(FilePath.java:865)
      	at hudson.FilePath.act(FilePath.java:838)
      	at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:986)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1142)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1331)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:682)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:587)
      	at hudson.model.Run.execute(Run.java:1557)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:236)
      Caused by: hudson.plugins.git.GitException: Error performing command:  clone -o origin ssh://<URL> /var/lib/jenkins/jobs/<project>/workspace
      	at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:904)
      	at hudson.plugins.git.GitAPI.access$000(GitAPI.java:42)
      	at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:269)
      	at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:248)
      	at hudson.FilePath.act(FilePath.java:865)
      	at hudson.FilePath.act(FilePath.java:838)
      	at hudson.plugins.git.GitAPI.clone(GitAPI.java:248)
      	... 14 more
      Caused by: java.lang.NullPointerException
      	at hudson.Launcher.printCommandLine(Launcher.java:607)
      	at hudson.Launcher.maskedPrintCommandLine(Launcher.java:629)
      	at hudson.Launcher$LocalLauncher.launch(Launcher.java:754)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:353)
      	at hudson.Launcher$ProcStarter.join(Launcher.java:360)
      	at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:885)
      	... 20 more
      Trying next repository
      ERROR: Could not clone repository
      FATAL: Could not clone
      hudson.plugins.git.GitException: Could not clone
      	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1056)
      	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:986)
      	at hudson.FilePath.act(FilePath.java:865)
      	at hudson.FilePath.act(FilePath.java:838)
      	at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:986)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1142)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1331)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:682)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:587)
      	at hudson.model.Run.execute(Run.java:1557)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:236)
      

      As system user jenkins (which runs Jenkins) I am perfectly able to run that command:

      $ git --version
      git version 1.7.9.5
      

      Cloning worked before, but all of a sudden the above error occurs.

      I tried both to specify the full path to the git executable (/usr/bin/git) and to specify the name of the executable only (without path: git). However, without success.

        Issue Links

          Activity

          Hide
          mburger Martin Burger added a comment -

          Might be a duplicate.

          Show
          mburger Martin Burger added a comment - Might be a duplicate.
          Hide
          mburger Martin Burger added a comment -

          Well, I found a workaround:

          1. Add new Git installation in global settings.
          2. In the job configuration, got to "Source Code Management -> Git -> Advanced..." and select the above installation as Git executable.
          3. Trigger new build.

          The new build should now be able to clone using git.

          Somehow, creating a new Git installation (global config) and choosing that installation as Git executable (job config) propagated the proper settings to the job.

          Show
          mburger Martin Burger added a comment - Well, I found a workaround: Add new Git installation in global settings. In the job configuration, got to "Source Code Management -> Git -> Advanced..." and select the above installation as Git executable. Trigger new build. The new build should now be able to clone using git. Somehow, creating a new Git installation (global config) and choosing that installation as Git executable (job config) propagated the proper settings to the job.
          Hide
          yclian YC Lian added a comment -

          Am having the same problem. There're 2 matters here:

          1. It shouldn't be labeled as "Git installation directory" but "Git executable"
          2. Not going to "Advanced" to "Save" will not enable the workaround - damn!

          Thanks Martin.

          Show
          yclian YC Lian added a comment - Am having the same problem. There're 2 matters here: 1. It shouldn't be labeled as "Git installation directory" but "Git executable" 2. Not going to "Advanced" to "Save" will not enable the workaround - damn! Thanks Martin.
          Hide
          markewaite Mark Waite added a comment -

          The current git-client-plugin and git-plugin releases do not call "git --version", so I believe this is resolved

          Show
          markewaite Mark Waite added a comment - The current git-client-plugin and git-plugin releases do not call "git --version", so I believe this is resolved

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              mburger Martin Burger
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: