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

Authentication problems using SSH #27

Open
sky-ricardocarrapico opened this issue Aug 18, 2022 · 0 comments · May be fixed by #28
Open

Authentication problems using SSH #27

sky-ricardocarrapico opened this issue Aug 18, 2022 · 0 comments · May be fixed by #28

Comments

@sky-ricardocarrapico
Copy link

Hi! I was starting to integrate the plugin in our repository but hit a wall pretty fast regarding authentication.

Using

authentication {
    sshWithPublicKey()
}

Was resulting in

Caused by: org.gradle.api.GradleException: Unable to clone repository contents: git@github.com:[team]/[repo.git]: Auth fail

This was pretty weird as I'm able to run git clone git@github.com:[team]/[repo.git] without any issue or having to type any passphrase. I even removed the passphrase from the SSH key but no dice.

Drilling a bit into it, I found that this particular error means that JGit can't load an SSH key. Then I found this: gradle/gradle#8245

Gradle seems to have the same issue with source dependencies. More specifically, there's one comment that seems to fix the Auth fail error: gradle/gradle#8245 (comment)

But then, another error appears:

Caused by: org.gradle.api.GradleException: Unable to clone repository contents: git@github.com:[team]/[repo.git]: invalid privatekey: [B@36ad118

It seems the current JGit version does not support the newer SSH key formats. We're in this weird situation where the newer OpenSSH versions, by default, generate a key that JGit doesn't support.

There's already a drop in replacement for JGit, which supports these new formats: https://github.com/mwiede/jsch
Example PR on Gradle repo, switching to this new version: gradle/gradle#20387

Is it possible to migrate to this new version on the plugin? Thank you!

@kakai248 kakai248 linked a pull request Aug 22, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant