This worked locally for me, but failed on our CI servers with the following exception:
Caused by: com.jcraft.jsch.JSchException: java.io.FileNotFoundException: /home/tools/.ssh/id_github_rsa (No such file or directory)
at com.jcraft.jsch.KeyPair.load(KeyPair.java:543)
at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:406)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:366)
at org.eclipse.jgit.transport.JschConfigSessionFactory.getJSch(JschConfigSessionFactory.java:372)
at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:308)
at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:175)
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:105)
... 258 more
Caused by: java.io.FileNotFoundException: /home/tools/.ssh/id_github_rsa (No such file or directory)
at com.jcraft.jsch.Util.fromFile(Util.java:508)
at com.jcraft.jsch.KeyPair.load(KeyPair.java:540)
... 265 mor
After looking at how our CI has ssh setup, I noticed it was using an .ssh/config file, while I am not locally. My guess is that the CI server setup is doing something modern/fancy with .ssh/config and the outdated jsch lib that Gradle uses internally ends up thinking that /home/tools/.ssh/id_github_rsa - when it in fact, does not.
I forked a library for an immediate fix for an issue and attempted to build that code from source, using the following:
This worked locally for me, but failed on our CI servers with the following exception:
After looking at how our CI has
ssh
setup, I noticed it was using an.ssh/config
file, while I am not locally. My guess is that the CI server setup is doing something modern/fancy with.ssh/config
and the outdatedjsch
lib that Gradle uses internally ends up thinking that/home/tools/.ssh/id_github_rsa
- when it in fact, does not.Updating the ssh lib to something more modern would likely solve this issue - something along the lines of https://github.com/gradle/gradle/issues/19028
Your Environment
Using Gradle 7.4
Issue occurred on both these VMs
Did not occur on my local MacOS 11.16.3