danielflower / multi-module-maven-release-plugin

A maven release plugin that is fast, does not add extra commits, and works well with single or multiple modules
http://danielflower.github.io/multi-module-maven-release-plugin/index.html
MIT License
125 stars 64 forks source link

Build throws USERAUTH fail error #48

Open mkampmey opened 7 years ago

mkampmey commented 7 years ago

Hello! I get an error if I execute the command "mvn releaser:release". In our company we are using bitbucket for all our git repositories and private/public keys for authentication. Here is the stacktrace. Any ideas what could be wrong?

[ERROR] ssh://git@***/multi-module-test.git: USERAUTH fail [ERROR] Stack trace: [ERROR] org.eclipse.jgit.api.errors.TransportException: ssh://git@***/multi-module-test.git: USERAUTH fail at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:221) at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:159) at com.github.danielflower.mavenplugins.release.LocalGitRepo.allRemoteTags(LocalGitRepo.java:186) at com.github.danielflower.mavenplugins.release.Reactor.getRemoteBuildNumbers(Reactor.java:115) at com.github.danielflower.mavenplugins.release.Reactor.fromProjects(Reactor.java:47) at com.github.danielflower.mavenplugins.release.ReleaseMojo.execute(ReleaseMojo.java:113) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.eclipse.jgit.errors.TransportException: ssh://git@***/multi-module-test.git: USERAUTH fail at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:160) at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:137) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:264) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:162) at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:198) ... 27 more Caused by: com.jcraft.jsch.JSchException: USERAUTH fail at com.jcraft.jsch.UserAuthPublicKey.start(UserAuthPublicKey.java:119) at com.jcraft.jsch.Session.connect(Session.java:463) at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:117) ... 31 more

apedano commented 6 years ago

Same issue

beatngu13 commented 5 years ago

Same here, although my SSH key is under ~/.ssh/id_rsa:

[ERROR] 
[ERROR] 
[ERROR] 
[ERROR] ************************************
[ERROR] Could not execute the release plugin
[ERROR] ************************************
[ERROR] 
[ERROR] 
[ERROR] There was an error while accessing the Git repository. The error returned from git was:
[ERROR] git@bitbucket.org:retest/surili.git: USERAUTH fail
[ERROR] Stack trace:
[ERROR] org.eclipse.jgit.api.errors.TransportException: git@bitbucket.org:retest/surili.git: USERAUTH fail
    at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:223)
    at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:161)
    at com.github.danielflower.mavenplugins.release.RemoteTagFetcher.getTags(LocalGitRepo.java:241)
    at com.github.danielflower.mavenplugins.release.LocalGitRepo.allTags(LocalGitRepo.java:211)
    at com.github.danielflower.mavenplugins.release.Reactor.getRemoteBuildNumbers(Reactor.java:120)
    at com.github.danielflower.mavenplugins.release.Reactor.fromProjects(Reactor.java:46)
    at com.github.danielflower.mavenplugins.release.ReleaseMojo.execute(ReleaseMojo.java:126)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.jgit.errors.TransportException: git@bitbucket.org:retest/surili.git: USERAUTH fail
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:182)
    at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:140)
    at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:280)
    at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:170)
    at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:200)
    ... 28 more
Caused by: com.jcraft.jsch.JSchException: USERAUTH fail
    at com.jcraft.jsch.UserAuthPublicKey.start(UserAuthPublicKey.java:119)
    at com.jcraft.jsch.Session.connect(Session.java:470)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:136)
    ... 32 more

And when I check that SSH connection via ssh -T git@bitbucket.org, everything is fine.

danielflower commented 5 years ago

I can't reproduce. Can someone please run with debug logs enabled and provide them? mvn -X releaser:release

danielflower commented 5 years ago

Also you could try specifying the path to the private key. See http://danielflower.github.io/multi-module-maven-release-plugin/ssh-authentication.html

Note that from 3.0.2 HTTPS is also supported if that's easier.

beatngu13 commented 5 years ago

Thanks for the fast response, Daniel. I forgot I was using a passphrase for my SSH key, which caused the error. Although I wasn't able to make it work by specifying the passphrase in the settings.xml, removing the passphrase did the trick. My bad!