Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using putty's pagent with egit in Eclipse

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

like image 282
P.T. Avatar asked Oct 14 '11 01:10

P.T.


People also ask

What is EGit in Eclipse?

Eclipse EGit™ EGit is an Eclipse Team provider for the Git version control system. Git is a distributed SCM, which means every developer has a full copy of all history of every revision of the code, making queries against the history very fast and versatile.

How do I fix rejected non fast forward in Eclipse?

If you do a commit in one project and then accidentally push this commit, with bypassing code review, to another project, this will fail with the error message 'non-fast forward'. To fix the problem you should check the push specification and verify that you are pushing the commit to the correct project.

How do I merge two branches in Eclipse?

Your task is to merge a different branch into that branch. After doing a "fetch" to ensure that your branch metadata is up to date, right-click on the repository and select "Merge...". Select the branch you want to merge into your current branch. After that completes, inspect the "Git Staging" view.


1 Answers

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.

like image 178
Navarr Avatar answered Sep 23 '22 12:09

Navarr