Reputation: 9373
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 [email protected]
.
To load it into eclipse (v2020-12; EGit v5.11), I went here: Preferences --> SSH2 --> Key Management --> Load Existing Key...
When attempting to add the private key, 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?
Upvotes: 1
Views: 5961
Reputation: 9373
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:
Clone a Git Repository and add the clone to this view
--> GitHub
Search
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://[email protected]/eclipse/org.aspectj
and then it worked like a charm.
Upvotes: 2
Reputation: 1326686
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.
Upvotes: 1