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

Git plugin fails to checkout master branch on remote slave

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • git-plugin

      Upgraded to version 2.0 of the Git plugin today when it was available in my plugin manager. Created an jgit Git plugin in the settings, and updated my git settings as shown in the config.xml below.

      The build fails quickly with the following error when trying to check out origin/master.

      Started by user Jonas Rabbe
      [EnvInject] - Loading node environment variables.
      Building remotely on Regular Jenkins Slave (i-1dc1d27a) in workspace /home/jenkins/workspace/radius-master
      [ssh-agent] Using credentials git (Radius repo deploy key)
      [ssh-agent] Looking for ssh-agent implementation...
      [ssh-agent]   Java/JNR ssh-agent
      [ssh-agent] Started.
      Wiping out workspace first.
      Cloning the remote Git repository
      remote: Counting objects
      remote: Compressing objects
      Receiving objects
      Resolving deltas
      Updating references
      Checking out Revision 5bd8914ecb46307249add0916b3493160c882096 (origin/master)
      FATAL: Could not checkout null
      hudson.plugins.git.GitException: Could not checkout null
      	at org.jenkinsci.plugins.gitclient.JGitAPIImpl.checkout(JGitAPIImpl.java:202)
      	at org.jenkinsci.plugins.gitclient.JGitAPIImpl.checkoutBranch(JGitAPIImpl.java:239)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299)
      	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280)
      	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239)
      	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(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:724)
      Caused by: org.eclipse.jgit.api.errors.InvalidRefNameException: Branch name <null> is not allowed
      	at org.eclipse.jgit.api.CheckoutCommand.processOptions(CheckoutCommand.java:471)
      	at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:200)
      	at org.jenkinsci.plugins.gitclient.JGitAPIImpl.checkout(JGitAPIImpl.java:187)
      	... 16 more
      

      My config.xml for the SCM part looks like this:

        <scm class="hudson.plugins.git.GitSCM" plugin="git@2.0">
          <configVersion>2</configVersion>
          <userRemoteConfigs>
            <hudson.plugins.git.UserRemoteConfig>
              <url>git@github.com:RadiusIntelligence/radius.git</url>
              <credentialsId>6893051d-565e-4a85-8c56-5d6f88f45d1a</credentialsId>
            </hudson.plugins.git.UserRemoteConfig>
          </userRemoteConfigs>
          <branches>
            <hudson.plugins.git.BranchSpec>
              <name>origin/master</name>
            </hudson.plugins.git.BranchSpec>
          </branches>
          <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
          <gitTool>jgit</gitTool>
          <submoduleCfg class="list"/>
          <extensions>
            <hudson.plugins.git.extensions.impl.WipeWorkspace/>
          </extensions>
        </scm>
      

            ndeloof Nicolas De Loof
            jrabbe Jonas Rabbe
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: