0

I try to release a Project in GitHub using Maven.

<scm>
    <connection>scm:git:git://github.com/jenkinsci/jabber-server-plugin.git</connection>
    <developerConnection>scm:git:git@github.com/jenkinsci/jabber-server-plugin.git</developerConnection>
    <url>http://github.com/jenkinsci/jabber-server-plugin</url>
</scm>

Unfortunately maven fails to git-clone to a server @github.com.

Full story:

fatal: Unable to look up @github.com (port 9418) 
  (Beim Datenbankaufruf ist ein nicht behebbarer Fehler aufgetreten. )

Any suggestions what i need to do to force the hostname github.com?

Grim
  • 1,938
  • 10
  • 56
  • 123

3 Answers3

1

First, if you need to specify the ssh user git@:

<developerConnection>scm:git:git@github.com:jenkinsci/jabber-server-plugin.git</developerConnection>

That is: ':' instead of '/' after github.com, as illustrated in:


If that still fails, you have some workaround possible:

If you want to keep an ssh url for the developerConnection part, try to see if the url examples work better:

scm:git:ssh://server_name[:port]/path_to_repository

That is:

<developerConnection>scm:git:ssh://git@github.com/jenkinsci/jabber-server-plugin.git</developerConnection>

(so specifying explicitly the ssh:// protocol, as used in "How to Use Maven Release Plugin with GitHub Releases")


As a last resort, you could try another protocol which doesn't have to use a non-default port or ssh, like the https one, as listed in Maven SCM Git:

scm:git:https://server_name[:port]/path_to_repository

That would give:

<scm>
    <connection>scm:git:https://github.com/jenkinsci/jabber-server-plugin.git</connection>
    <developerConnection>scm:git:https://yourLogin@github.com/jenkinsci/jabber-server-plugin.git</developerConnection>
    <url>http://github.com/jenkinsci/jabber-server-plugin</url>
</scm>
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • BTW: for `:` instead of `/` i had to `ssh-add .ssh/id_rsa`. After that `release:perform` ran into a NPE. – Grim Jun 13 '14 at 05:33
  • @PeterRader try first with an ssh key without passphrase (no need to `ssh-add` then) for testing purpose. – VonC Jun 13 '14 at 05:40
  • I tried this an ran into http://stackoverflow.com/questions/3243755/maven-error-releasing-code-to-github-hangs-after-push . Anyway the NPE is actually the problem caused at `InstallMojo.execute(InstallMojo.java:116)`. Ill investigate the code now... – Grim Jun 13 '14 at 05:42
  • @PeterRader I didn't remember having answered that one too! – VonC Jun 13 '14 at 05:44
  • even if i have a ssh key without passphrase (not sure how that can be possible - i always are asked for a passphrase), i need to add the key anyway to a agent. Is there a benefit i do not see without a passprase? The NPE causes on the `maven-release-plugin` in version `2.0-beta-9` i will try to upgrade the plugin. – Grim Jun 13 '14 at 05:51
  • @PeterRader simply hit return when ask for a passphrase ;) – VonC Jun 13 '14 at 05:52
  • @PeterRader since yu have a passphrase-protected key, this isn't related to http://maven.apache.org/guides/mini/guide-deployment-security-settings.html, is it? – VonC Jun 13 '14 at 06:45
  • yes it is, but i dont see why this method should be used if its more easy to add the key via commandline. i guess we are far away from the NPE bug and from my question. – Grim Jun 13 '14 at 06:52
  • 1
    @PeterRader I agree, I was just checking. Anyway, I would still try with a simpler ssh key, just to rule that out. – VonC Jun 13 '14 at 06:53
1

Using windows this is not possible. I installed debian using virtualbox and this is the story:

  1. java -version (gives me openjdk, from experiences i know: i need a oracle/sun's jdk)
  2. (download java from oracle and install, export JAVA_HOME...-stuff also)
  3. java -version (gives me oracle/sun jdk now, fine)
  4. su
  5. apt-get install maven
  6. apt-get install git
  7. apt-get install jenkins
  8. exit
  9. git clone https://github.com/jenkinsci/jabber-server-plugin
  10. cd jabber-server-plugin
  11. su
  12. vi /etc/maven/settings.xml (add mirror ...)
  13. exit
  14. mvn release:prepare release:perform (error pid-file cant be written)
  15. su
  16. /etc/init.d/jenkins stop
  17. exit
  18. mvn release:prepare release:perform (error: github-user-unknown)
  19. ssh-add github-private-key (enter password)
  20. mvn release:prepare release:perform (error: jenkins-ci.org 401)
  21. mvn release:prepare release:perform -Dpassword -Dusername (error: github takes jenkins-ci.org's password instead keystore, darn)
  22. su
  23. vi /etc/maven/settings.xml (move password and username from -Dparam to maven's part)
  24. exit
  25. mvn release:prepare release:perform (error: 401, i read doc and i need to paste the encryptet-password (slat or something more))
  26. https://repo.jenkins-ci.org/webapp (Login, open my account, unlock to edit profile, copy encryptet password).
  27. vi /etc/maven/settings.xml (overwrite the 's password from clipboard )
  28. mvn release:prepare release:perform

BUILD SUCCESS

(mental stagedive)

Grim
  • 1,938
  • 10
  • 56
  • 123
  • Good feedback, more complete than my answer. +1 – VonC Jul 13 '14 at 10:03
  • @VonC You are welcome. I would not be able to solve this problem without your pressure to use a certificate! – Grim Jul 14 '14 at 10:26
  • After restart a simple `ssh-add github-private-key` and `mvn release:prepare release:perform` is enougth. – Grim Jul 16 '14 at 09:37
0

Following should work for your project

<scm>
    <connection>scm:git:git://github.com/jenkinsci/jabber-server-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:jenkinsci/jabber-server-plugin.git</developerConnection>
    <url>http://github.com/jenkinsci/jabber-server-plugin</url>
</scm>
SubOptimal
  • 22,518
  • 3
  • 53
  • 69
  • This is exactly the same what VonC said. – Grim Jun 13 '14 at 10:23
  • More ore less. He proposed to use for a different protocoll, which is (from my point of view) is not necessary. I bundled everything together. So it woul de easier for others to get a backed solution. But I agree: there was nothing not yet mentioned on this page in my answer. ;-) – SubOptimal Jun 13 '14 at 12:09