Repository: mina-sshd
Updated Branches:
  refs/heads/master 2d6fbc94a -> 9a87c27e1


[SSHD-797] Updated README documentation to reflect enhanced 
GitSshdSessionFactory capabilities and its usage with JGIT


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/9a87c27e
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/9a87c27e
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/9a87c27e

Branch: refs/heads/master
Commit: 9a87c27e13a40f5dc43d3542ff5bb2f9e8d1970b
Parents: c645152
Author: Goldstein Lyor <[email protected]>
Authored: Wed Jan 31 17:47:28 2018 +0200
Committer: Goldstein Lyor <[email protected]>
Committed: Wed Jan 31 18:00:43 2018 +0200

----------------------------------------------------------------------
 README.md | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/9a87c27e/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 5cc741f..82e92d3 100644
--- a/README.md
+++ b/README.md
@@ -1333,7 +1333,38 @@ The distribution also includes also an _sshd_ script 
that can be used to launch
 
 ## GIT support
 
-The _sshd-git_ artifact contains server-side command factories for handling 
some _git_ commands - see `GitPackCommandFactory` and `GitPgmCommandFactory`. 
These command factories accept a delegate to which non-_git_ commands are 
routed:
+The _sshd-git_ artifact contains both client and server-side command factories 
for issuing and handling some _git_ commands. The code is based on 
[JGit](https://github.com/eclipse/jgit)
+and iteracts with it smoothly.
+
+### Client-side
+
+This module provides SSHD-based replacements for the SSH and SFTP transports 
used by the JGIT client - see `GitSshdSessionFactory` - it can be used as a 
drop-in replacement
+for the [JSCH](http://www.jcraft.com/jsch/) based built-in session factory 
provided by _jgit_. In this context, it is worth noting that the 
`GitSshdSessionFactory` has been tailored so as to provide
+flexible control over which `SshClient` instance to use, and even which 
`ClientSession`. The default instance allocates a **new** client every time a 
new `GitSshdSession` is created - which is
+started and stopped as necessary. However, this can be pretty wasteful, so if 
one intends to issue several commands that access GIT repositories via SSH, one 
should maintain a **single**
+client instance and re-use it:
+
+
+```java
+
+    SshClient client = ...create and setup the client...
+    try {
+        client.start();
+        
+        GitSshdSessionFactory sshdFactory = new GitSshdSessionFactory(client); 
 // re-use the same client for all SSH sessions
+        org.eclipse.jgit.transport.SshSessionFactory.setInstance(sshdFactory); 
 // replace the JSCH-based factory
+
+        ... issue GIT commands that access remote repositories via SSH ....
+        
+    } finally {
+        client.stop();
+    }
+
+```
+
+### Server-side
+
+See `GitPackCommandFactory` and `GitPgmCommandFactory`. These command 
factories accept a delegate to which non-_git_ commands are routed:
 
 
 ```java
@@ -1349,7 +1380,6 @@ The _sshd-git_ artifact contains server-side command 
factories for handling some
     // or any other combination ...
 ```
 
-
 ## LDAP adaptors
 
 The _sshd-ldap_ artifact contains an 
[LdapPasswordAuthenticator](https://issues.apache.org/jira/browse/SSHD-607) and 
an [LdapPublicKeyAuthenticator](https://issues.apache.org/jira/browse/SSHD-608) 
that have been written along the same lines as the 
[openssh-ldap-publickey](https://github.com/AndriiGrytsenko/openssh-ldap-publickey)
 project. The authenticators can be easily configured to match most LDAP 
schemes, or alternatively serve as base classes for code that extends them and 
adds proprietary logic.

Reply via email to