Eclipse git and ssh-agent
Asked Answered
S

4

8

I use eclipse with git (egit).

I would like to make use of my ssh-agent so I can push from eclipse. Does anybody know how to set up egit to use ssh-agent?

background: I can't upload my key to eclipse as my keys are on a cryptostick. My ssh-agent can loaded with the help of opensc.

Seclusive answered 15/11, 2012 at 11:16 Comment(0)
I
7

Update June 2016 (4 years later): Gunnar Wagenknecht now mentions in the comments:

It's now possible in Eclipse Neon with project eclipseguru/eclipse-jsch-agent-proxy, an Eclipse ssh-agent and Pageant support.

https://static.mcmap.net/file/mcmap/ZG-AbGLDKwfwW7bQXRlAZGyic7MlbmMvan-lan3QWRft/eclipseguru/eclipse-jsch-agent-proxy/gh-pages/images/ssh-agent-preferences.png


A workaround for older Eclipse versions is to use the native OS SSH client instead of the Eclipse built-in one by setting GIT_SSH environment variable:

export GIT_SSH=/usr/bin/ssh

(See EGit SSH configuration and EGit FAQ, SSH Config)

Intemperate answered 15/11, 2012 at 13:40 Comment(5)
@gautamvegeta you can try (not tested myself) bugs.eclipse.org/bugs/show_bug.cgi?id=179924#c28Intemperate
The repository/plugin is no longer maintained. :-(Enantiomorph
@Enantiomorph 7 years later, I am not chocked :) bugs.eclipse.org/bugs/show_bug.cgi?id=541274 might include more up-to-date (2019) references.Intemperate
Note that (as of Q1/2021) OS-provided ssh agents (such as seahorse on Ubuntu) are still not supported on Linux workstations; see: eclipse.org/lists/egit-dev/msg04781.htmlPricket
@Pricket That is too bad. I hope those agents will be supported soon.Intemperate
S
10

In your eclipse startup script or .profile (or wherever) add export GIT_SSH=/usr/bin/ssh before starting eclipse. Then eclipse uses default ssh which uses ssh agent and you cann run pull and push commands within eclipse even if your key is on a smartcard.

Edit: GIT_SSH is interpreted by eclipse's egit, but also by the stand-alone git. Setting it to /usr/bin/ssh sets it to the default value for stand-alone git, so only egit will change it's behavior.

Seclusive answered 18/4, 2014 at 15:48 Comment(1)
If you set GIT_SSH in .profile and Eclipse complains about missing /usr/bin/ssh-askpass make sure you don't have conflicts in your .ssh/known_hosts. For instance, try git fetch in a terminal in the same Git working copy and see if it complains about the host.Seaplane
I
7

Update June 2016 (4 years later): Gunnar Wagenknecht now mentions in the comments:

It's now possible in Eclipse Neon with project eclipseguru/eclipse-jsch-agent-proxy, an Eclipse ssh-agent and Pageant support.

https://static.mcmap.net/file/mcmap/ZG-AbGLDKwfwW7bQXRlAZGyic7MlbmMvan-lan3QWRft/eclipseguru/eclipse-jsch-agent-proxy/gh-pages/images/ssh-agent-preferences.png


A workaround for older Eclipse versions is to use the native OS SSH client instead of the Eclipse built-in one by setting GIT_SSH environment variable:

export GIT_SSH=/usr/bin/ssh

(See EGit SSH configuration and EGit FAQ, SSH Config)

Intemperate answered 15/11, 2012 at 13:40 Comment(5)
@gautamvegeta you can try (not tested myself) bugs.eclipse.org/bugs/show_bug.cgi?id=179924#c28Intemperate
The repository/plugin is no longer maintained. :-(Enantiomorph
@Enantiomorph 7 years later, I am not chocked :) bugs.eclipse.org/bugs/show_bug.cgi?id=541274 might include more up-to-date (2019) references.Intemperate
Note that (as of Q1/2021) OS-provided ssh agents (such as seahorse on Ubuntu) are still not supported on Linux workstations; see: eclipse.org/lists/egit-dev/msg04781.htmlPricket
@Pricket That is too bad. I hope those agents will be supported soon.Intemperate
C
1

No way! Sooo many years of eclipse out there and still no way to work with a smartcards and ssh/ssh-agent? Really disappointing come back to eclipse..

https://bugs.eclipse.org/bugs/show_bug.cgi?id=179924

Cumbersome answered 7/8, 2017 at 19:40 Comment(0)
S
0

Checkout cac-agent. It includes cac-ssl-relay, which can work as a universal tunnel from any client application that needs CAC access (including git/eclipse).

Synchronism answered 19/1, 2019 at 3:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.