1

I used Git for Windows (v2.30.1) to create an ed25519 ssh key with ssh-keygen -t ed25519 -C “<github email>” per this github doc and added it to my account. I verified it works from Git CMD with ssh -T git@github.com.

To load it into eclipse (v2020-12; EGit v5.11), I went here: Preferences --> SSH2 --> Key Management --> Load Existing Key...

For both the private and public keys, I got this error failed to load given file. EGit v5.4+ "supports" an ed25519 key, but I could find no instructions (expected them here) for how to get one into eclipse. Googling for the error was unhelpful.

How do I use my ed25519 key with eclipse?

cb4
  • 6,689
  • 7
  • 45
  • 57
  • Did you add the private key in the preferences in _General > Network Connections > SSH2_ in the tab _General_ (as described in the [EGit help/documentation](https://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration))? – howlger Feb 13 '21 at 09:16
  • @howlger Your comment got me one step closer. I was already on the Key Management tab (having generated a RSA key) and tried to Load Existing Key from there. From the General tab, I successfully added my ed25519 key. Now getting a connection error that I'm investigating... – cb4 Feb 15 '21 at 21:05

2 Answers2

2

It seems odd that you can't use Load Existing Key to, well, load an ssh key. I’m not the only one to make that mistake... Thanks to Howlger for pointing out the relevant doc here. The correct way to add a key is from the General tab by clicking Add Private Key… and selecting your ed25519 private key file (not the one ending in “.pub”).

I am fairly new at git, so I'm doing as much of it in the eclipse GUI (aka EGit) as possible. I had already cloned a public repo from the Git perspective like so:

  1. Clicked Clone a Git Repository and add the clone to this view --> GitHub
  2. Typed org.aspectj in Search box and clicked Search
  3. Selected eclipse/org.aspectj and clicked Next
  4. Selected the master branch --> Next --> entered local directory
  5. Clicked Finish

The steps are important because EGit defaulted the repo URI for the remote origin like this: https://github.com/eclipse/org.aspectj. Now that I had my ssh key loaded, I wanted to change that. So, still in the Git perspective, under Remotes I right-clicked origin, clicked Configure push, then Change… and clicked the protocol dropdown, selected ssh and Finish. Back at the Configure push for remote ‘origin’ window, I clicked Save and Push and got this error:

Can't connect to any repository: ssh://github.com/eclipse/org.aspectj (ssh://github.com/eclipse/org.aspectj: Cannot log in at github.com:22)

Troubleshooting finally led me to this github documentation about the “git” user . I only needed to update origin’s URI to ssh://git@github.com/eclipse/org.aspectj and then it worked like a charm.

cb4
  • 6,689
  • 7
  • 45
  • 57
1

For testing, try the same key, but without a passphrase.

The error "failed to load given file" was indeed reported for keys (even simple id_rsa ones) with passphrase.

Eclipse issue 326526 mentions:

Another, much simpler workaround is to remove the (AES) passphrase using OpenSSH and then ask the (old) JSch to set the same passphrase again - using DES3 (DES seen here).

Even though OpenSSH's is now using AES by default it supports DES3 fine. Using DES3 the same passphrase can be shared across all agents. No GIT_SSH variable required. Tested.

That means:

Recreate your key with passphrase if you want, but using the old PEM format:

ssh-keygen -m PEM ...

That or you would need to use a fork of Jsch.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250