[JIRA] [git-client-plugin] (JENKINS-19921) Git clone fails with JGit and SSH Credentials

215 views
Skip to first unread message

oded@geek.co.il (JIRA)

unread,
Jul 16, 2015, 8:39:03 PM7/16/15
to jenkinsc...@googlegroups.com
Oded Arbel commented on Bug JENKINS-19921
 
Re: Git clone fails with JGit and SSH Credentials

I have the same problem: changing git provider to JGit gives me this:

{{
ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject@7582f1de[orchestration]
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.jenkinsci.plugins.gitclient.JGitAPIImpl.getHeadRev(JGitAPIImpl.java:746)
at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:576)
at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:526)
at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:381)
at hudson.scm.SCM.poll(SCM.java:398)
at hudson.model.AbstractProject._poll(AbstractProject.java:1459)
at hudson.model.AbstractProject.poll(AbstractProject.java:1362)
at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:510)
at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:539)
at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
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:745)
}}

I'm using an SSH key that is installed in Jenkins credentials system, using "git" as the user name. changing the git URL for the project to not have the user name part, as E. Sammer mentioned, does not change anything for me.

I'm using the latest git plugin

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

oded@geek.co.il (JIRA)

unread,
Aug 13, 2015, 12:29:02 PM8/13/15
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 13, 2015, 1:59:01 PM8/13/15
to jenkinsc...@googlegroups.com

Oded Arbel I think your problem is most likely a configuration problem that is specific to your site, not a general problem with the plugin. I frequently use ssh secured connections between various slaves (Windows, CentOS, Debian, Ubuntu) and various different git repositories (GItHub, Assembla, bitbucket, sourceforge, and more) successfully. Many, many of the 60000+ installations of the git plugin also use ssh authenticated connections.

The fact that both JGit and CliGit show the problem seems like a further indication that the problem is not in the git plugin or the git client plugin.

krzyk@java.net (JIRA)

unread,
Apr 4, 2016, 7:21:03 AM4/4/16
to jenkinsc...@googlegroups.com
krzyk commented on Bug JENKINS-19921

Mark Waite I don't think this is an isolated problem, I have exactly the same on jgit using ssh credentials doesn't work, and I get the same stacktrace, using the latest git client plugin.
I'm using credentials that should retrieve keys from the .ssh directory.

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 4, 2016, 8:20:01 AM4/4/16
to jenkinsc...@googlegroups.com

I'm reasonably confident it is an isolated problem.

There are are many use models which use the JGit implementation with ssh credentials. There are automated tests of JGit with ssh credentials. I have acceptance test cases I regularly run from a docker instance to confirm JGit with ssh credentials to multiple servers, including a personal ssh based git server, assembla, bitbucket, github, and gitlab. Those tests are all passing.

If it weren't an isolated problem, I'd expect more of the installations to be reporting the issue, especially since the last comment on this closed bug report is from Aug 2015.

Tizkiko@gmail.com (JIRA)

unread,
May 18, 2016, 7:52:02 AM5/18/16
to jenkinsc...@googlegroups.com
Tizki KO commented on Bug JENKINS-19921

Oded Arbel I have the same issue, have you managed to solve it?

mark.earl.waite@gmail.com (JIRA)

unread,
May 18, 2016, 10:07:02 AM5/18/16
to jenkinsc...@googlegroups.com

I'm still not able to duplicate this with the current code. Automated and interactive tests of JGit with an RSA private key continue to run correctly on Windows, Ubuntu 12, Ubuntu 14, Debian 7, Debian 8, Debian 9 pre-release, CentOS 6, and CentOS 7. The tests uses private git repositories on assembla, bitbucket, gitlab, github, and on two different private computers that I host at home.

I have 2 JGit based failures in the automated test suite that are only visible when using the git client plugin 1.20 beta and the git plugin 2.5 beta with submodule authentication configured to use the credentials of the parent repository. If that's the case you're seeing, please share that information.

If you have more details, or a publicly accessible way to duplicate the bug, I'm certainly interested. I'm also interested if you've been able to successfully connect to the same repository with command line git rather than JGit.

oded@geek.co.il (JIRA)

unread,
May 19, 2016, 4:00:03 AM5/19/16
to jenkinsc...@googlegroups.com

Tizki KO : Haven't happened to me for a while now, I don't remember what I changed - if at all.

dc00shop@gmail.com (JIRA)

unread,
Jun 2, 2016, 11:19:03 AM6/2/16
to jenkinsc...@googlegroups.com

Other people (http://stackoverflow.com/questions/34317581/jenkins-workflow-multibranch-with-git-illegalstateexception) including me, are having this same problem.

I am using Jenkins 2.7 with the multibranch plugin, all plugins are at the latest version.

If I create a project, and add a "Branch Source" of "Git", type in the repository (g...@git.DOMAIN.com:/opt/git/PROJECT.git), select credentials that work everywhere else in Jenkins, and click "Save" I get a "Branch Indexing Log" screen with this stack trace:

Started
Setting origin to git@git.(DOMAIN).com:/opt/git/(PROJECT).git
Fetching origin...
FATAL: Failed to recompute children of deleteme multibranch
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:678)
	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:174)
	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:157)
	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:122)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE

mark.earl.waite@gmail.com (JIRA)

unread,
Jun 2, 2016, 12:20:02 PM6/2/16
to jenkinsc...@googlegroups.com

Dave Claus please open a separate bug report for that problem. It sounds like it is specific to the multi-branch plugin rather than the git plugin or the git client plugin.

dc00shop@gmail.com (JIRA)

unread,
Jun 2, 2016, 1:37:03 PM6/2/16
to jenkinsc...@googlegroups.com

Looks like the actual bug is JENKINS-33983. The workaround (also posted in that JIRA) 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".

ptho0@yahoo.com (JIRA)

unread,
Aug 1, 2016, 4:02:01 PM8/1/16
to jenkinsc...@googlegroups.com
ptho ho commented on Bug JENKINS-19921

I run into the same issue. Pipeline works but Multibranch Pipeline job doesn't work . Add JGit to under GIT in Global Tool Configuration as well, it's not working.

Setting origin to g...@github.somecompany.com:RnD/test.git
Fetching origin...
FATAL: Failed to recompute children of test_multibranch_pipeline


java.lang.IllegalStateException: Cannot open session, connection is not authenticated.

I tried different credentials, none worked in multibranch pipeline.

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 1, 2016, 4:15:01 PM8/1/16
to jenkinsc...@googlegroups.com

Refer to JENKINS-36958 for the bug which tracks one case where a multi-branch pipeline cannot authenticate in the same environment where a freestyle job can authenticate. The distinction in that case is that the freestyle job uses command line git for its initial clone, while the multi-branch pipeline uses JGit

Reply all
Reply to author
Forward
0 new messages