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

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

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            nghialv Nghia Le Van added a comment -

            I have same this problem.

            nghialv Nghia Le Van added a comment - I have same this problem.
            rainoko Raino Kolk added a comment - - edited

            I had same issue.
            Seems that it is related somehow how you defined git credentials in jenkins.
            No problem if you copied PK directly to credential.
            No problem if you give full path of private key: /usr/lib/jenkins/.ssh/id_rsa for example
            Problem occured when using relative path ~/.ssh/id_rsa

            Hope this helps someone

            rainoko Raino Kolk added a comment - - edited I had same issue. Seems that it is related somehow how you defined git credentials in jenkins. No problem if you copied PK directly to credential. No problem if you give full path of private key: /usr/lib/jenkins/.ssh/id_rsa for example Problem occured when using relative path ~/.ssh/id_rsa Hope this helps someone
            fortuna Ben Fortuna added a comment - - edited

            jglick I have a dependency on CLI git as we use an SSH over HTTP tunneling config. I don't think JGit is able to support this..

            EDIT: There is an open ticket on support extra SSH options in JGit also - JENKINS-28351

            fortuna Ben Fortuna added a comment - - edited jglick I have a dependency on CLI git as we use an SSH over HTTP tunneling config. I don't think JGit is able to support this.. EDIT: There is an open ticket on support extra SSH options in JGit also - JENKINS-28351

            Pull request attached

            jcechace Jakub Cechacek added a comment - Pull request attached
            markewaite Mark Waite added a comment -

            Included in git plugin 2.6.0, released 2 Sep 2016.

            markewaite Mark Waite added a comment - Included in git plugin 2.6.0 , released 2 Sep 2016.

            People

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

              Dates

                Created:
                Updated:
                Resolved: