Honor ~/.ssh/config whenever possible during SSH based transport
commitd1389f7a7caecfc0c480b60a397406f70dae048c
authorShawn O. Pearce <spearce@spearce.org>
Fri, 15 Aug 2008 17:35:05 +0000 (15 10:35 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Tue, 19 Aug 2008 21:06:46 +0000 (19 23:06 +0200)
tree4c21d8fe8dac93f5306a87193e9785c0b6a5b166
parentebcae3361515f6fee4763b59584a0cb423c59161
Honor ~/.ssh/config whenever possible during SSH based transport

I rely on ~/.ssh/config to setup host aliases, especially for very
common destinations.  For example I have the following on most of
my systems:

Host orcz
HostName repo.or.cz
User spearce
IdentityFile .ssh/id_orcz

as not every system I use has my local user name as "spearce".  The
C Git transport honors these settings just fine for short URLs like
"orcz:/srv/git/egit.git" but jgit failed horribly on these as there
is no local system named "orcz" on any of my networks.

By reading (and caching) the ~/.ssh/config file jgit can now honor
the important aspects of the host configuration blocks, allowing it
to use the same URLs as C Git.

The JSch API does not seem to allow forcing a specific key identity
for a Session so we are forced to load the identity file listed in
the configuration into the core JSch object we are running with.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.egit.ui/src/org/spearce/egit/ui/EclipseSshSessionFactory.java
org.spearce.jgit.test/tst/org/spearce/jgit/transport/OpenSshConfigTest.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/transport/DefaultSshSessionFactory.java
org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java [new file with mode: 0644]