Egit 拒绝接受 id_rsa

发布于 2024-11-30 14:55:14 字数 352 浏览 1 评论 0原文

我是第一次尝试在 Eclipse 中设置 egit 的 git 用户,这样我就可以继续通过 Eclipse 轻松编码。问题是,每次我尝试通过 egit 克隆存储库时,都会出现错误“无法列出可用分支。原因:ssh://[电子邮件受保护]:22 密码/Users/elifinkelshteyn/.ssh/id_rsa。”这真的很奇怪,因为我可以使用相同的 id_rsa 通过终端进行克隆,而且我已经在 Eclipse ssh 属性中验证了它正在尝试使用正确的密钥。什么给?

I'm a first time git user trying to setup egit in Eclipse so I can continue to easily code through Eclipse. Problem is, every time I try to clone a repo through egit, it gives me the error "Cannot list available branches. Reason: ssh://[email protected]:22 Passphrase for /Users/elifinkelshteyn/.ssh/id_rsa." This is really strange as I can clone through terminal using that same id_rsa just fine, and I've verified in Eclipse ssh properties that it is trying to use the correct key. What gives?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

我要还你自由 2024-12-07 14:55:14

如果提示输入密码,但 Eclipse 不接受密码,请尝试以下操作:

将 GIT_SSH 环境变量设置为 ssh 客户端,例如,通过添加

export GIT_SSH=/usr/bin/ssh

Mac OSX 上的 .bash_rc,打开终端并键入:

cd
mkdir .MacOSX
cd .MacOSX
echo "" > environment.plist
open environment.plist

添加 KEY= GIT_SSH 与 VALUE=/usr/bin/ssh
并保存文件。

重新登录您的帐户后,它应该可以工作。

if you get a prompt for the passphrase but eclipse doesn't accept the passphrase, try the following:

set the GIT_SSH environment variable to your ssh client e.g. by adding

export GIT_SSH=/usr/bin/ssh

to your .bash_rc

on Mac OSX, open terminal and type:

cd
mkdir .MacOSX
cd .MacOSX
echo "" > environment.plist
open environment.plist

add a KEY=GIT_SSH with VALUE=/usr/bin/ssh
and save the file.

After relogin to your account, it should work.

窗影残 2024-12-07 14:55:14

只是为了确认:这是一个当前错误(问题 353561)。< br>
并且密码可能仍然是一个问题,具体取决于创建密钥时使用的加密(bug 326526)。

但是,应该支持密码(正如 Egit 用户指南提到的)。

Just to confirm: this is a current bug (issue 353561).
And passphrase might still be a problem depending on the encryption you used when creating your key (bug 326526).

However, passphrase are supposed to be supported (as the Egit user guide mentions).

诗化ㄋ丶相逢 2024-12-07 14:55:14

正如 VonC 所说,这是一个错误,EGit 使用的 SSH 实现只能处理 3DES 加密私钥之外的任何内容。
如果您像我一样,您有 AES 加密密钥,因此它无法解密它们。
该错误报告中有一条评论,这里有一个直接指向该评论的链接 https ://bugs.eclipse.org/bugs/show_bug.cgi?id=326526#c9

该评论提供了一个可行的解决方法:最新版本的 EGit 支持 GIT_SSH 环境变量,将其设置为 /usr/bin/ssh 甚至 plink.exe(如果您使用的是 Windows)应该可以解决问题。

As VonC says, it's a bug that the SSH implementation that EGit uses can't handle anything but 3DES encrypted private keys.
If you're like me, you have AES encrypted keys, so it just fails to decrypt them.
There is a comment in that bug report, here's a link directly to the comment https://bugs.eclipse.org/bugs/show_bug.cgi?id=326526#c9

That comment provided a working workaround: recent versions of EGit honour the GIT_SSH environment variable, setting that to /usr/bin/ssh or even plink.exe if you're on windows should solve the issue.

梦醒灬来后我 2024-12-07 14:55:14

自OP以来已经过去了相当长的一段时间,我仍然遇到同样的问题。对于仍然遇到此问题的人,这可能会有所帮助:

确保您设置了推送遥控器。当我遇到“无法获取远程存储库引用”问题时(“...密码...”和“推送...”对话框中的“身份验证失败”),它对我有用。

假设您已经:

  1. 使用 Github 设置您的 SSH 密钥(窗口 > 首选项 > 常规 > 网络连接 > SSH2)

  2. 设置您的本地存储库(您可以按照本指南

  3. 创建了一个 Github 存储库(相同指南

。 .. 操作方法如下:

  • 转到 Git 存储库视图(窗口 > 显示视图 > 其他 > Git 存储库)
  • 展开您的存储库并右键单击远程 --> “创建远程”
  • “远程名称”:来源,“配置推送”:选中 --> 单击“确定”
  • 单击“更改...”按钮
  • 粘贴您的 git URI 并选择协议ssh - -> 单击“完成”
  • 现在,单击“保存并推送”,现在您应该会收到密码提示 --> 在此处输入公钥密码(前提是您确实(并且应该)为您的公钥设置了密码)--> 点击“确定”
  • 现在您应该会看到一个确认窗口,显示“已推送到 YourRepository - origin” --> 点击“确定”
  • 推送到上游,但这次使用“配置的远程存储库”作为您的目标 Git 存储库
  • 去给自己喝杯咖啡吧!

A considerable amount of time has passed since the OP and I still had the same problem. For those who still has this problem, this might help:

Make sure you did setup a push remote. It worked for me when I got both the Cannot get remote repository refs-problems ("... Passphrase for..." and "Auth fail" in the "Push..." dialog).

Provided that you already:

  1. Setup your SSH keys with Github (Window > Preferences > General > Network Connections > SSH2)

  2. Setup your local repository (you can follow this guide for that)

  3. Created a Github repository (same guide)

... here's how you do it:

  • Go to the Git Repositories view (Window > Show View > Other > Git Repositories)
  • Expand your Repository and right click Remotes --> "Create Remote"
  • "Remote Name": origin, "Configure push": checked --> click "OK"
  • Click the "Change..." button
  • Paste your git URI and select protocol ssh --> click "Finish"
  • Now, click "Save and Push" and NOW you should get a password prompt --> enter the public key passphrase here (provided that you DID (and you should) setup a passphrase to your public key) --> click "OK"
  • Now you should get a confirmation window saying "Pushed to YourRepository - origin" --> click "OK"
  • Push to upstream, but this time use "Configured remote repository" as your Destination Git repository
  • Go get yourself a well earned cup of coffee!
凉城凉梦凉人心 2024-12-07 14:55:14

看起来您的 /Users/elifinkelshteyn/.ssh/id_rsa 文件需要密码,并且我不确定 Eclipse 中的 ssh 实现是否知道如何提示您输入密码。让我感到很兴奋的是,你可能需要为 mac 安装一个 ssh-auth 软件包,这样它才能进行提示,如果你能找到更多相关信息,那可能是理想的选择。然而,短期内的解决方法是生成一个不使用密码的新 rsa 密钥,将其上传到 github,然后设置 eclipse 使用它。

It looks like your /Users/elifinkelshteyn/.ssh/id_rsa file requires a password, and I'm not sure that the ssh implementation in Eclipse knows how to prompt you for one. It's tickling the back of my brain that there's probably an ssh-auth package you need to install for the mac so that it can prompt, and if you can find out more about that, it's probably ideal. However, a workaround in the short term is to generate a new rsa key that doesn't use a password, upload that to github, and set eclipse to use it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文