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

Multibranch Pipeline with git uses jgit, but should use git installation that is configured

      When I create Multibranch Pipeline and add a git source (which requires a private key to authenticate) branch indexing doesn't work and throws following exception:

      java.lang.IllegalStateException: Cannot open session, connection is not authenticated.
      	at com.trilead.ssh2.Connection.openSession(Connection.java:1127)
      	at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:32)
      	at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262)
      	at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161)
      	at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
      	at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
      	at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
      	at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
      	at org.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:672)
      	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:171)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:146)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:296)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:151)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:110)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      

      It looks like jgit is used by default, but I don't have it in "Manage Jenkins" I have only command line git, which should be used.

          [JENKINS-33983] Multibranch Pipeline with git uses jgit, but should use git installation that is configured

          krzyk created issue -
          Matthew DeTullio made changes -
          Component/s New: workflow-plugin [ 18820 ]
          Component/s Original: multi-branch-project-plugin [ 21127 ]
          Matthew DeTullio made changes -
          Assignee Original: Matthew DeTullio [ mjdetullio ] New: Jesse Glick [ jglick ]

          D Claus added a comment -

          So to further elaborate on this, a workaround is to go into "Manage Jenkins" -> "Global Tool Configuration" then under "Git" click "Add Git" then select "JGit". See also https://wiki.jenkins-ci.org/display/JENKINS/Git+plugin+2.0+beta+testing#Gitplugin2.0betatesting-ActivatingJGit.

          The attached links says "go to the system configuration page" which should read "go into the Global Tool Configuration page".

          D Claus added a comment - So to further elaborate on this, a workaround is to go into "Manage Jenkins" -> "Global Tool Configuration" then under "Git" click "Add Git" then select "JGit". See also https://wiki.jenkins-ci.org/display/JENKINS/Git+plugin+2.0+beta+testing#Gitplugin2.0betatesting-ActivatingJGit . The attached links says "go to the system configuration page" which should read "go into the Global Tool Configuration page".

          Jesse Glick added a comment -

          Generally, GitSCMSource should allow GitInstallation selection.

          Jesse Glick added a comment - Generally, GitSCMSource should allow GitInstallation selection.
          Jesse Glick made changes -
          Component/s New: git-plugin [ 15543 ]
          Component/s Original: workflow-plugin [ 18820 ]
          Jesse Glick made changes -
          Labels New: multibranch workflow

          Jesse Glick added a comment -

          That said, I do not know why you encountered this error. Both CLI Git and JGit support SSH private key authentication. Did you specify your private key under Credentials in the SCM source configuration?

          Jesse Glick added a comment - That said, I do not know why you encountered this error. Both CLI Git and JGit support SSH private key authentication. Did you specify your private key under Credentials in the SCM source configuration?

          dc00, the problems seems to be that JGit is used, so configuring Jenkins explicitly to use JGit will likely not fix that. I am running into the same problem as the requester has, JGit is used despite I have only one git configuration and that is a local one (that works from console).

          Oliver Gondža added a comment - dc00 , the problems seems to be that JGit is used, so configuring Jenkins explicitly to use JGit will likely not fix that. I am running into the same problem as the requester has, JGit is used despite I have only one git configuration and that is a local one (that works from console).

          Nghia Le Van added a comment -

          I have same this problem.

          Nghia Le Van added a comment - I have same this problem.

            jcechace Jakub Cechacek
            krzyk krzyk
            Votes:
            6 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: