Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release] NPE during tagging #1435

Open
gunnarmorling opened this issue Jul 1, 2023 · 4 comments
Open

[release] NPE during tagging #1435

gunnarmorling opened this issue Jul 1, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@gunnarmorling
Copy link

Getting this one:

Caused by: org.eclipse.jgit.api.errors.TransportException: git@github.com:decodableco/decodable-job-sdk.git: remote hung up unexpectedly
        at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:147)
        at org.jreleaser.sdk.git.release.ReleaseUtils.tagRelease(ReleaseUtils.java:90)
        ... 128 more
Caused by: org.eclipse.jgit.errors.TransportException: git@github.com:decodableco/decodable-job-sdk.git: remote hung up unexpectedly
        at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.<init>(TransportGitSsh.java:382)
        at org.eclipse.jgit.transport.TransportGitSsh.openPush(TransportGitSsh.java:159)
        at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:127)
        at org.eclipse.jgit.transport.Transport.push(Transport.java:1384)
        at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:137)
        ... 129 more
Caused by: java.lang.NullPointerException
        at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:107)
        at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.<init>(TransportGitSsh.java:358)

Seems like that org.eclipse.jgit.ssh.jsch dependency would need to be added?

@gunnarmorling gunnarmorling added the bug Something isn't working label Jul 1, 2023
@gunnarmorling
Copy link
Author

gunnarmorling commented Jul 1, 2023

Some more context on this one: my git remote was configured to use SSH, not HTTPS. This seems to generally be unsupported with JReleaser currently, since even when I added that dependency, things wouldn't work. It'd still try to authenticate with user name and PAT (as the UsernamePasswordCredentialsProvider is hard-coded in ReleaseUtils), instead of using key-based authentication.

IMO, the best solution to all this would be to use the native git installation (by launching an external process) instead of using jgit. Then I should be able to use key-based auth, with the key passphrase being retrieved from my SSH agent. Another issue with jgit is that the jsch dependency isn't actively maintained, so newer key formats like ed25519 aren't supported.

I got unstuck by changing my remote to use HTTPS, I think it's worth calling out in the docs that SSH isn't supported atm.? And/or fail eagerly with a descriptive error message when detecting that SSH is used.

@aalmiray aalmiray added this to the v1.8.0 milestone Jul 1, 2023
@aalmiray
Copy link
Member

aalmiray commented Jul 1, 2023

Failing quickly when SSH is configured as protocol sounds like a quick win we should support right away.

Switching to external git command will take more effort but it's feasible.

@aalmiray aalmiray changed the title NPE during tagging [release] NPE during tagging Jul 1, 2023
@aalmiray aalmiray removed this from the v1.8.0 milestone Aug 24, 2023
@haydenbaker
Copy link

Edge case here - only realized the problem was SSH after I found this issue. I had git configured to globally use ssh instead of https, which I feel is fairly common. It would be a good idea to call this out in the docs, or more specifically, the checklist. Thanks!

@aalmiray
Copy link
Member

FWIW regarding the state of jsch 👇 https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/68bd2c146239b87d355ed6169ca0ec227a69995d/org.eclipse.jgit.ssh.jsch/

JGit SSH support via JSch

This bundle provides an implementation of git transport over SSH implemented via JSch.

This bundle should be considered deprecated. It is essentially unmaintained, and the JGit project may decide anytime to remove it completely without further ado.

The officially supported SSH transport is in bundle org.eclipse.jgit.ssh.apache and is built upon Apache MINA sshd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants