If you want to import a project from GitHub or Heroku into Eclipse, you can use the Git import wizard found under:
Eclipse menu: File -> Import -> Git / Projects from Git
However for me, the wizard would refuse to finish. There was no error dialog, nothing just happened when I pressed Finish. When something like this happens in Eclipse, you should check the error log. You can open it’s view from:
Eclipse menu: Window -> Show View -> Error Log
When I pressed finish, this log entry appeared:
Unhandled event loop exception
java.lang.NullPointerException
. at org.eclipse.egit.core.securestorage.EGitSecureStore.calcNodePath(EGitSecureStore.java:86)
. at org.eclipse.egit.core.securestorage.EGitSecureStore.putCredentials(EGitSecureStore.java:55)
. at org.eclipse.egit.ui.internal.SecureStoreUtils.storeCredentials(SecureStoreUtils.java:36)
. at org.eclipse.egit.ui.internal.clone.GitCloneWizard.performFinish(GitCloneWizard.java:197)
. ...
. at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
The stack trace provides a clue: GitCloneWizard.performFinish
is invoking SecureStoreUtils.storeCredentials
… This is actually an option represented by a checkbox in the wizard. On the bottom of the Clone Git Repository page of the wizard, below the User and Password fields, there is a checkbox marked ‘Store in Secure Store’. This checkbox is checked by default.
Now when using SSH with pulic and private RSA keys, you can encrypt the private key with a password (as added security) and Eclipse will pop up a dialog asking for it. It will then remember this password in the secure store if you checked the option for that. However, securing your private key is optional and I did not use it. No password was needed for my key so Eclipse never asked for it. But this stacktrace shows that it is still trying to store it. The secure store seems to not expect this as it chokes on the null
password with a NullPointerException
…which brings us to:
The workaround
If you use a private SSH key that is not protected by a password, just uncheck the ‘Store in Secure Store’ checkbox to prevent this issue and the wizard should finish successfully as it did for me.
I reported this bug to Eclipse: BUG 372485.
Ah it seems this issue is fixed in the latest version of EGit, which can be downloaded directly from within Eclipse. Great!