git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: egit and RSA keys for SSH

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 15, 2009, 15:03 UTC
Message-ID
<20090615150341.GX16497@spearce.org>
In-Reply-To
<F2969C1B08CBEE42B78C04C280D578E72CAF41E19B@donkey.landcare.ad.landcareresearch.co.nz>
Aaron Hicks <HicksA@landcareresearch.co.nz> wrote:
Show 15 quoted lines
> We have a git repository set up with gitosis and it requires RSA
> keys to authenticate developers who have rights to push to this
> repository. i.e. they are blessed with write privileges. Github
> uses a similar method.
> 
> We use Eclipse, so we would like Eclipse to integrate with Git. So
> we grabbed egit from http://www.jgit.org/update-site and used the
> Eclipse installer (Like we do all the other Eclipse plug-in, given
> that the egit/jgit sites don't give instructions otherwise it seems
> to be the thing to do).
> 
> The problem is I can't see how to associate an RSA key in order
> to authenticate the SSH login with our gitosis repository (or
> GitHub). We have PuTTY installed and use Pageant to manage keys, and
> the required key is already loaded.

Unfortunately both PuTTY's Pageant and OpenSSH's ssh-agent are not supported from JSch, which is the SSH client used within JGit, which is what is underneath EGit. Consequently, you can't use the agent to manage your keys.

>From within Eclipse, if you go to Window > Preferences > General >

Network Connections > SSH2 you can configure your RSA keys. But, these keys are configured globally for the workspace, i.e. its more like loading the key into the agent than it is about binding a particular key to a particular host.

To force binding a key to a host, use ~/.ssh/config. JGit knows how to read this file on startup and uses the Host blocks to do some configuration control over the connection.

E.g. if you use a URL like "git@gitserver.example.com:foo.git" then you can put the following in your ~/.ssh/config to force using a specific SSH key:

  Host gitserver.example.com
    IdentityFile .ssh/id_gitkey

Note that ~/.ssh/config is cached on startup of EGit, so you'll need to completely restart the Eclipse workspace after making any changes to it.

-- 
Shawn.
Previous: Shawn O. PearceNext: Aaron Hicks
Message 4 of 6 in “egit and RSA keys for SSH”
  1. Aaron HicksJun 15, 2009
  2. Tay Ray ChuanJun 15, 2009
  3. Shawn O. PearceJun 15, 2009
  4. Shawn O. PearceJun 15, 2009
  5. Aaron HicksJun 15, 2009
  6. Shawn O. PearceJun 16, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.