org.eclipse.jgit.transport

## Class SshTransport

- java.lang.Object
- - org.eclipse.jgit.transport.Transport
  - - org.eclipse.jgit.transport.TcpTransport
    - - org.eclipse.jgit.transport.SshTransport

Direct Known Subclasses:
  TransportGitSsh, TransportSftp

    public abstract class SshTransport
    extends TcpTransport

The base class for transports that use SSH protocol. This class allows customizing SSH connection settings.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.eclipse.jgit.transport.Transport

`Transport.Operation`

### Field Summary

### Fields inherited from class org.eclipse.jgit.transport.Transport

`DEFAULT_FETCH_THIN, DEFAULT_PUSH_THIN, local, REFSPEC_PUSH_ALL, REFSPEC_TAGS, uri`

### Constructor Summary

Constructors
`protected` `SshTransport(Repository local, URIish uri)` Create a new transport instance.
`protected` `SshTransport(URIish uri)` Create a new transport instance without a local repository.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Close any resources used by this transport.
`protected RemoteSession` `getSession()` Get the default SSH session
`SshSessionFactory` `getSshSessionFactory()`
`void` `setSshSessionFactory(SshSessionFactory factory)` Set SSH session factory instead of the default one for this instance of the transport.

### Methods inherited from class org.eclipse.jgit.transport.Transport

`applyConfig, fetch, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, getCredentialsProvider, getObjectChecker, getOptionReceivePack, getOptionUploadPack, getPackConfig, getTagOpt, getTimeout, getTransportProtocols, getURI, isCheckFetchedObjects, isDryRun, isFetchThin, isPushThin, isRemoveDeletedRefs, open, open, open, open, open, open, open, openAll, openAll, openAll, openAll, openFetch, openPush, push, push, register, setCheckFetchedObjects, setCredentialsProvider, setDryRun, setFetchThin, setObjectChecker, setOptionReceivePack, setOptionUploadPack, setPackConfig, setPushThin, setRemoveDeletedRefs, setTagOpt, setTimeout, unregister`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SshTransport

    protected SshTransport(Repository local,
                           URIish uri)

Create a new transport instance.

Parameters:
  `local` - the repository this instance will fetch into, or push out of. This must be the repository passed to `Transport.open(Repository, URIish)`.
  `uri` - the URI used to access the remote repository. This must be the URI passed to `Transport.open(Repository, URIish)`.

#### SshTransport

    protected SshTransport(URIish uri)

Create a new transport instance without a local repository.

Parameters:
  `uri` - the URI used to access the remote repository. This must be the URI passed to `Transport.open(URIish)`.
Since:
  3.5

### Method Detail

#### setSshSessionFactory

    public void setSshSessionFactory(SshSessionFactory factory)

Set SSH session factory instead of the default one for this instance of the transport.

Parameters:
  `factory` - a factory to set, must not be null
Throws:
  `IllegalStateException` - if session has been already created.

#### getSshSessionFactory

    public SshSessionFactory getSshSessionFactory()

Returns:
  the SSH session factory that will be used for creating SSH sessions

#### getSession

    protected RemoteSession getSession()
                                throws TransportException

Get the default SSH session

Returns:
  a remote session
Throws:
  `TransportException` - in case of error with opening SSH session

#### close

    public void close()

Description copied from class: `Transport`
Close any resources used by this transport.

If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.

Specified by:
  `close` in class `Transport`