IntershopCommunicationsAG/scmversion-gradle-plugin

Gradle tag using git ssh transport asking for (kerberos) password

Opened this issue · 1 comments

Hi,
when trying to issue gradle tag my build hangs in an interactive prompt asking for my Kerberos password. When reading your code I understand it only supports git over ssh when url starts with 'git@'. There is no supported way to use Kerberos credentials or any kind of password authentication when accessing GitLab over SSH (since it depends on ~/ssh/authorized_keys) to my knowledge. Therefor a patch such as this should be fine:

--- a/src/main/groovy/com/intershop/gradle/scm/services/git/SshConnector.groovy
+++ b/src/main/groovy/com/intershop/gradle/scm/services/git/SshConnector.groovy
@@ -70,6 +70,7 @@ class SshConnector extends JschConfigSessionFactory {
     protected void configure(OpenSshConfig.Host hc, Session session) {
         session.setConfig("StrictHostKeyChecking", "no")
         session.setConfig("UserKnownHostsFile", "/dev/null")
+        session.setConfig("PreferredAuthentications", "publickey")
     }

Since I haven't done a very thourough code reading I thought I would just ask before sending a PR. If this patch looks good to you please apply it or ask for a PR or let me know what I need to do to enhance it for you to accept it.

It is possible to use username and password instead of a public key. In this case the credentials must be stored in your private gradle.properties or environment. An input during the execution of the plugin is not a good idea, because the plugin must also run on a CI system.