在 Eclipse 中使用 putty 的 pagent 和 egit

发布于 2024-12-10 06:14:23 字数 1347 浏览 0 评论 0原文

我正在尝试通过 Eclipse 'egit' 模块访问私有远程 SSH git 存储库。我在 Windows 上运行 Eclipse。 Eclipse 似乎并没有自动与 putty 的 pagent 一起进行授权转发,而且我找不到任何有关自定义 egit 使用的 SSH 的文档(例如,使用 plink.exe)。

我在网上找到了有关设置其他 Windows git 客户端以使用 putty/plink (例如,对于 msysgit)的文档,但我似乎找不到有关 Eclipse 的 egit 和 putty (或 eclipse)的任何信息。

我确信 ssh 密钥可以正常工作,因为我一直使用它通过 Putty 登录服务器。

具体来说,我使用 Git 存储库查看器,单击“克隆远程存储库”,填写主机、存储库路径、协议 (ssh) 和用户。我点击“下一步”。我可以判断它已连接,因为我收到了一个带有服务器独特横幅的弹出窗口。然后我得到

Transport Error: Cannot list the available branches: Reason: <URI>: Auth fail

The ssh login is by sshkey only,所以这就是为什么这不起作用(但至少它表明我已经掌握了基础知识)。

有人用 egit+pageant 取得成功吗?或者知道这是否不可能?

更新

这似乎不起作用,因为 Eclipse 在内部使用了一个纯 Java SSH (jsch) 实现,并且 Eclipse 包含的该实现(尚)不支持授权代理协议。

已经提出了一些通过支持平台 ssh 代理的补丁(感谢@Janning 提供的链接)。请参阅此 Eclipse 错误 179924。更新 #24 包含有关拟议补丁的令人鼓舞的说明:

我已确认我可以访问 http://github.com/ 并克隆 egit 的一些项目与 putty 的 pageant 一起。

我不太确定,但目前的问题似乎是围绕纯 java unix 域套接字库以及升级 Eclipse 使用的纯 java SSH 实现的一些许可问题。

最近的错误(编号 360663)显示所需的 jsch 版本已一直致力于 Eclipse(据我所知应该是下一个版本的一部分——应该是 2012 年 6 月下旬)。

I'm trying to access a private remote SSH git repository via the Eclipse 'egit' module. I'm running Eclipse on Windows. Eclipse doesn't seem to automagically work with putty's pagent for authorization forwarding and I can't find any documentation about customizing the SSH used by egit (e.g., to use plink.exe).

I've found documentation on the web about setting up other Windows git clients to use putty/plink (e.g., for msysgit), but I can't seem to find anything about Eclipse's egit and putty (or eclipse).

I'm confident the ssh key works normally, as I use it all the time to log into the server with Putty.

Specifically, I use the Git Repository Viewer, click 'Clone Remote Repository', fill in the host, repository path, protocol (ssh), and user. I Click 'Next'. I can tell that its connecting because I get a pop-up with my server's unique banner. Then I get a

Transport Error: Cannot list the available branches: Reason: <URI>: Auth fail

The ssh login is by sshkey only, so that's why this doesn't work (but at least it shows I've got the basics down).

Anyone have success with egit+pageant? Or know if its just not possible?

Update

It seems that this doesn't work because Eclipse has a pure-Java SSH (jsch) implementation internally that it uses, and that implementation Eclipse contains does not (yet) support the authorization agent protocols.

Some patches to support platform ssh agents via the have been proposed (thanks to @Janning for the link). See this Eclipse bug 179924. Update #24 includes this encouraging note about the proposed patches:

I have confirmed that I can get accesses to http://github.com/ and clone
some projects by egit with putty's pageant.

I'm not entirely sure, but it seems like the current hangups are some licensing issues around a pure-java unix-domain socket library, and upgrading the pure-java SSH implementation that Eclipse uses.

A more recent bug (number 360663) shows the required version of jsch has been committed to Eclipse (and as far as I can tell should be part of the next release -- should be end of June 2012).

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

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

发布评论

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

评论(4

这个俗人 2024-12-17 06:14:23

阅读 morellet.d 的答案后,我能够非常简单地为自己设置这个。

我添加了用户环境变量 GIT_SSH 并将其设置为“C:\Program Files (x86)\PuTTY\plink.exe”,因此,您只需将其设置为 plink 文件所在的位置即可。

说明适用于 PuTTY 0.62、最新的 EGit 和 Eclipse Juno x64。

After reading morellet.d's answer, I was able to set this up for myself very simply.

I added the user environment variable GIT_SSH and set it to "C:\Program Files (x86)\PuTTY\plink.exe" So, you just need to set it to wherever your plink file is and it will work.

Instructions worked with PuTTY 0.62, the latest EGit and Eclipse Juno x64.

怪异←思 2024-12-17 06:14:23

找到了一个更好的解决方案,允许使用 pagent 密钥而不是 eclipse(openssh) 密钥。
对于我或其他人来说,尝试在 Windows 上使用 Eclipse、GitBash、plink 和 pagent(带或不带 keepass)。

根本原因是,错误消息是谎言。 可能是由于参数无效且与服务器密钥无关而无法调用 plink.exe 造成的。 (JGIT 开发人员应该修复)。

EGIT 使用 JGit,并将参数传递给 "-p [port] [server] "git-upload-pack '[project]'" plink.exe。

该参数适用于 openssh ,但是,它与 plink.exe 不兼容
, plink.exe 需要大写 "-P" 作为 ssh 端口。


将此文件另存为“plink.cmd”

@ECHO OFF
SET c="plink.exe" -ssh -agent -l [username]

:loop
if NOT _%1_ == __ (
 IF _%1_ == _-p_ (
  SET c=%C% -P
 ) else (
  SET c=%C% %1
 )
 shift
 goto loop
)
%c%

在Windows中,运行SETX GIT_SSH PATH_TO\plink.cmd上传环境变量。


享受 pagent 与 Windows 版 Eclipse 和 GIT Bash 的连接。

Found a better solution allows using pagent key rather then eclipse(openssh) key.
For me or someone else try to use Eclipse, GitBash, with plink and pagent (with or without keepass) on Windows.

The root cause is that, the error message lie. It may caused by failed to call plink.exe due to invalid parameter and nothing related to the server key. (JGIT developer should fix).

EGIT use JGit, and it pass argument to "-p [port] [server] "git-upload-pack '[project]'" plink.exe.

The argument is good for openssh, however, which is not compatible with plink.exe
, plink.exe requires capital "-P" for ssh port.


Save this file as "plink.cmd"

@ECHO OFF
SET c="plink.exe" -ssh -agent -l [username]

:loop
if NOT _%1_ == __ (
 IF _%1_ == _-p_ (
  SET c=%C% -P
 ) else (
  SET c=%C% %1
 )
 shift
 goto loop
)
%c%

In windows, run SETX GIT_SSH PATH_TO\plink.cmd to upload environment variable.


Enjoy connection of pagent with your Eclipse and GIT Bash for windows.

瑾兮 2024-12-17 06:14:23

eGit 使用 Eclipse 内置 SSH 功能识别的 SSH 密钥。将密钥加载到 http://wiki.eclipse.org/EGit/User_Guide 显示的 SSH2 首选项页面#Eclipse_SSH_Configuration

eGit is using the SSH keys that Eclipse's built-in SSH functionality knows about. Load the keys into the SSH2 preference page shown at http://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration .

不念旧人 2024-12-17 06:14:23

EGit + pageant 实际上对我有用(与 Eclipse SSH2 home/私钥配置相反......)

我在 Windows 7 上安装了 TortoiseGit + msysgit。

团队>的用户设置选项卡中git >配置 我只输入了我的姓名和电子邮件地址,并且登录密钥为空。
Repository Settings 选项卡中,URL 是从 github 的 ssh 链接复制并粘贴的,并且 puttykey 路径是正确的(例如 C:\Users\you\.ssh\yourkey.ppk< /代码>)。我使用的是没有密码的密钥。

我还添加了以下 Windows 系统变量: GIT_SSH=C:\\Program Files\\TortoiseGit\\bin\\TortoisePlink.exe

使用密钥启动选美比赛后添加它应该可以工作...

EGit + pageant actually works for me (contrary to the Eclipse SSH2 home/private key configuration...)

I am on Windows 7 with TortoiseGit + msysgit installed.

In the User Settings tab in Team > Git > Configuration I only put my name and email address and the signinkey is empty.
In the Repository Settings tab, the url is copy&pasted from github's ssh link and the puttykey path is correct (for ex. C:\Users\you\.ssh\yourkey.ppk). I am using a key without passphrase.

I also added the following windows system variable : GIT_SSH=C:\\Program Files\\TortoiseGit\\bin\\TortoisePlink.exe

Once the pageant is started with the key added it should work...

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