在 Eclipse 中使用带有 egit 的腻子页面

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7762139/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:09:52  来源:igfitidea点击:

Using putty's pagent with egit in Eclipse

eclipseputtyegitjsch

提问by P.T.

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

我正在尝试通过 Eclipse 'egit' 模块访问私有远程 SSH git 存储库。我在 Windows 上运行 Eclipse。Eclipse 似乎无法自动使用 putty 的 pagent 进行授权转发,而且我找不到任何有关自定义 egit 使用的 SSH 的文档(例如,使用 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).

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

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

我确信 ssh 密钥可以正常工作,因为我一直使用它来使用 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

具体来说,我使用Git Repository Viewer,点击'Clone Remote Repository',填写主机、存储库路径、协议(ssh)和用户。我点击“下一步”。我可以说它正在连接,因为我收到了一个带有我服务器独特横幅的弹出窗口。然后我得到一个

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

ssh 登录只能通过 sshkey 进行,所以这就是为什么这不起作用(但至少它表明我已经掌握了基础知识)。

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

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

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.

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

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:

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

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

我已经确认我可以访问http://github.com/并通过 egit 使用 putty 的选美来克隆一些项目。

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.

我不完全确定,但似乎当前的挂断是围绕纯 Java Unix 域套接字库的一些许可问题,以及升级 Eclipse 使用的纯 Java SSH 实现。

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

最近的一个错误(编号 360663)显示所需的 jsch 版本已提交给 Eclipse(据我所知应该是下一个版本的一部分——应该是 2012 年 6 月结束)。

回答by Navarr

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

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

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.

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

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

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

回答by Dennis C

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.

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

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

根本原因在于,错误消息是谎言。这可能由于涉及到服务器密钥无效的参数并没有什么造成无法通话plink.exe。(JGIT 开发人员应该修复)。

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

EGIT 使用 JGit,并将参数传递给"-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.

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



Save this file as "plink.cmd"

将此文件另存为“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.cmdto upload environment variable.

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



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

享受 pagent 与 Eclipse 和 GIT Bash for windows 的连接。

回答by nitind

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.

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

回答by morellet.d

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

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

I am on Windows 7 with TortoiseGit + msysgit installed.

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

In the User Settingstab in Team > Git > ConfigurationI only put my name and email address and the signinkey is empty. In the Repository Settingstab, 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.

User Settings选项卡中,Team > Git > Configuration我只输入我的姓名和电子邮件地址,而登录密钥为空。在Repository Settings选项卡中,url 是从 github 的 ssh 链接复制粘贴的,并且 puttykey 路径是正确的(例如C:\Users\you\.ssh\yourkey.ppk)。我正在使用没有密码的密钥。

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

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

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

一旦选美开始并添加了密钥,它应该可以工作......