如何在eclipse上添加ed25519 ssh密钥以与github一起使用? [英] How to add an ed25519 ssh key to eclipse for use with github?

查看:86
本文介绍了如何在eclipse上添加ed25519 ssh密钥以与github一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Windows版Git(v2.30.1)创建了一个ed25519 ssh密钥, ssh-keygen -t ed25519 -C< github电子邮件>"

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.

要将其加载到eclipse(v2020-12; EGit v5.11)中,我去了: Preferences->SSH2->密钥管理->加载现有密钥...

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

对于私钥和公钥,我都收到此错误无法加载给定文件. EGit v5.4 +支持"ed25519密钥,但我找不到任何说明(在这里预期了),了解如何使日食陷入困境.谷歌搜索错误是没有帮助的.

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.

如何在eclipse中使用ed25519键?

How do I use my ed25519 key with eclipse?

推荐答案

奇怪的是,您无法使用 Load Existing Key 来加载ssh密钥.我不是唯一一个犯该错误的人...感谢Howlger指出相关的doc .正确的添加密钥的方法是从常规"选项卡中,单击添加私有密钥…并选择ed25519私有密钥文件(不是以".pub"结尾的文件).

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").

我在git上还很新,所以我正在eclipse GUI(又名EGit)中做很多事情.我已经从Git的角度克隆了一个公共仓库,像这样:

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. 点击克隆Git存储库并将克隆添加到此视图-> GitHub
  2. 在搜索"框中键入org.aspectj,然后单击"搜索
  3. "
  4. 选择eclipse/org.aspectj并单击下一步"
  5. 选择了master分支->下一个->进入本地目录
  6. 点击完成

这些步骤很重要,因为EGit缺省为远程 origin 的存储库URI,如下所示: https://github.com/eclipse/org.aspectj .现在,我已经加载了ssh密钥,我想更改它.因此,仍然在Git透视图中,在 Remotes 下,我右键单击 origin ,单击 Configure push ,然后单击 Change…,然后点击协议下拉菜单,选择 ssh Finish .回到为远程原始"配置推送窗口,我点击了 Save and Push 并收到以下错误消息:

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)

故障排除最终导致我.我只需要将原始的URI更新为 ssh://git@github.com/eclipse/org.aspectj ,然后它就可以发挥作用了.

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.

这篇关于如何在eclipse上添加ed25519 ssh密钥以与github一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆