Top Description Inners Fields Constructors Methods
org.eclipse.jgit.transport

public Class TransportGitSsh

extends SshTransport
implements PackTransport
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.PackTransport
Imports
java.io.File, .IOException, .InputStream, java.text.MessageFormat, java.util.ArrayList, .Arrays, .Collection, .Collections, .EnumSet, .LinkedHashSet, .List, .Locale, .Map, .Set, org.eclipse.jgit.errors.NoRemoteRepositoryException, .NotSupportedException, .TransportException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.Constants, .Repository, org.eclipse.jgit.util.FS, .QuotedString, .SystemReader, org.eclipse.jgit.util.io.MessageWriter, .StreamCopyThread

Transport through an SSH tunnel.

The SSH transport requires the remote side to have Git installed, as the transport logs into the remote system and executes a Git helper program on the remote side to read (or write) the remote repository's files.

This transport does not support direct SCP style of copying files, as it assumes there are Git specific smarts on the remote side to perform object enumeration, save file modification and hook execution.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
private static final String
pack-priv static final TransportProtocol

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
checkExecFailure(int status, String exe, String why)

pack-priv NoRemoteRepositoryException
pack-priv String
private void
public FetchConnection
openFetch()

Implements abstract org.eclipse.jgit.transport.Transport.openFetch.

Begins a new connection for fetching from the remote repository.

public FetchConnection
openFetch(Collection<RefSpec> refSpecs, String...
that will be set as ref prefixes if the server supports git protocol V2; null values are ignored
additionalPatterns
)

Overrides org.eclipse.jgit.transport.Transport.openFetch.

Begins a new connection for fetching from the remote repository.

public PushConnection
openPush()

Implements abstract org.eclipse.jgit.transport.Transport.openPush.

Begins a new connection for pushing into the remote repository.

private static boolean
Inherited from org.eclipse.jgit.transport.SshTransport:
closegetSessiongetSshSessionFactorysetSshSessionFactory

Field Detail

EXTback to summary
private static final String EXT
PROTO_SSHback to summary
pack-priv static final TransportProtocol PROTO_SSH

Constructor Detail

TransportGitSshback to summary
pack-priv TransportGitSsh(Repository local, URIish uri)
TransportGitSshback to summary
pack-priv TransportGitSsh(URIish uri)

Method Detail

checkExecFailureback to summary
pack-priv void checkExecFailure(int status, String exe, String why) throws TransportException
cleanNotFoundback to summary
pack-priv NoRemoteRepositoryException cleanNotFound(NoRemoteRepositoryException nf, String why)
commandForback to summary
pack-priv String commandFor(String exe)
initSshSessionFactoryback to summary
private void initSshSessionFactory()
openFetchback to summary
public FetchConnection openFetch() throws TransportException

Implements abstract org.eclipse.jgit.transport.Transport.openFetch.

Doc from org.eclipse.jgit.transport.Transport.openFetch.

Begins a new connection for fetching from the remote repository.

If the transport has no local repository, the fetch connection can only be used for reading remote refs.

Returns:FetchConnection

a fresh connection to fetch from the remote repository.

Annotations
@Override
Exceptions
TransportException:
the remote connection could not be established.
openFetchback to summary
public FetchConnection openFetch(Collection<RefSpec> refSpecs, String... additionalPatterns) throws NotSupportedException, TransportException

Overrides org.eclipse.jgit.transport.Transport.openFetch.

Doc from org.eclipse.jgit.transport.Transport.openFetch.

Begins a new connection for fetching from the remote repository.

If the transport has no local repository, the fetch connection can only be used for reading remote refs.

If the server supports git protocol V2, the RefSpecs and the additional patterns, if any, are used to restrict the server's ref advertisement to matching refs only.

Transports that want to support git protocol V2 must override this; the default implementation ignores its arguments and calls openFetch().

Parameters
refSpecs:Collection<RefSpec>

that will be fetched via FetchConnection#fetch(ProgressMonitor, Collection, java.util.Set, OutputStream) later

additionalPatterns:String[]

that will be set as ref prefixes if the server supports git protocol V2; null values are ignored

Returns:FetchConnection

a fresh connection to fetch from the remote repository.

Annotations
@Override
Exceptions
NotSupportedException:
the implementation does not support fetching.
TransportException:
the remote connection could not be established.
openPushback to summary
public PushConnection openPush() throws TransportException

Implements abstract org.eclipse.jgit.transport.Transport.openPush.

Doc from org.eclipse.jgit.transport.Transport.openPush.

Begins a new connection for pushing into the remote repository.

Returns:PushConnection

a fresh connection to push into the remote repository.

Annotations
@Override
Exceptions
TransportException:
the remote connection could not be established
useExtSessionback to summary
private static boolean useExtSession()
org.eclipse.jgit.transport back to summary

private Class TransportGitSsh.ExtSession

extends Object
implements RemoteSession2
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.RemoteSession2, org.eclipse.jgit.transport.RemoteSession

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private ProcessBuilder
createProcess(List<String> args, Map<String, String> environment)

public void
disconnect()

Implements org.eclipse.jgit.transport.RemoteSession.disconnect.

Disconnects the remote session.

public Process
exec(String
command to execute
command
,
int
timeout value, in seconds, for creating the remote process
timeout
)

Implements org.eclipse.jgit.transport.RemoteSession.exec.

Creates a new remote Process to execute the given command.

public Process
exec(String
command to execute
command
,
Map<String, String>
environment variables to pass on
environment
,
int
timeout value, in seconds, for creating the remote process
timeout
)

Implements org.eclipse.jgit.transport.RemoteSession2.exec.

Creates a new remote Process to execute the given command.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ExtSessionback to summary
private ExtSession()

Method Detail

createProcessback to summary
private ProcessBuilder createProcess(List<String> args, Map<String, String> environment)
disconnectback to summary
public void disconnect()

Implements org.eclipse.jgit.transport.RemoteSession.disconnect.

Doc from org.eclipse.jgit.transport.RemoteSession.disconnect.

Disconnects the remote session.

Annotations
@Override
execback to summary
public Process exec(String command, int timeout) throws TransportException

Implements org.eclipse.jgit.transport.RemoteSession.exec.

Doc from org.eclipse.jgit.transport.RemoteSession.exec.

Creates a new remote Process to execute the given command. The returned process's streams exist and are connected, and execution of the process is already started.

Parameters
command:String

command to execute

timeout:int

timeout value, in seconds, for creating the remote process

Returns:Process

a new remote process, already started

Annotations
@Override
execback to summary
public Process exec(String command, Map<String, String> environment, int timeout) throws TransportException

Implements org.eclipse.jgit.transport.RemoteSession2.exec.

Doc from org.eclipse.jgit.transport.RemoteSession2.exec.

Creates a new remote Process to execute the given command. The returned process's streams exist and are connected, and execution of the process is already started.

Parameters
command:String

command to execute

environment:Map<String, String>

environment variables to pass on

timeout:int

timeout value, in seconds, for creating the remote process

Returns:Process

a new remote process, already started

Annotations
@Override
org.eclipse.jgit.transport back to summary

pack-priv Class TransportGitSsh.SshFetchConnection

extends BasePackFetchConnection
Class Inheritance

Field Summary

Modifier and TypeField and Description
private StreamCopyThread
private final Process
Inherited from org.eclipse.jgit.transport.BasePackFetchConnection:
ADVERTISEDCOMMONMIN_CLIENT_BUFFEROPTION_ALLOW_REACHABLE_SHA1_IN_WANTOPTION_ALLOW_TIP_SHA1_IN_WANTOPTION_FILTEROPTION_INCLUDE_TAGOPTION_MULTI_ACKOPTION_MULTI_ACK_DETAILEDOPTION_NO_DONEOPTION_NO_PROGRESSOPTION_OFS_DELTAOPTION_SHALLOWOPTION_SIDE_BANDOPTION_SIDE_BAND_64KOPTION_THIN_PACKREACHABLE

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
SshFetchConnection(Collection<RefSpec> refSpecs, String... additionalPatterns)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.eclipse.jgit.transport.BasePackFetchConnection.close.

Implements org.eclipse.jgit.transport.Connection.close.

Closes this resource, relinquishing any underlying resources.

Inherited from org.eclipse.jgit.transport.BasePackFetchConnection:
didFetchIncludeTagsdidFetchTestConnectivitydoFetchfetchfetchgetFetchConfiggetPackLocksonReceivePacksetPackLockMessage

Field Detail

errorThreadback to summary
private StreamCopyThread errorThread
processback to summary
private final Process process

Constructor Detail

SshFetchConnectionback to summary
pack-priv SshFetchConnection() throws TransportException
SshFetchConnectionback to summary
pack-priv SshFetchConnection(Collection<RefSpec> refSpecs, String... additionalPatterns) throws TransportException

Method Detail

closeback to summary
public void close()

Overrides org.eclipse.jgit.transport.BasePackFetchConnection.close.

Implements org.eclipse.jgit.transport.Connection.close.

Doc from org.eclipse.jgit.transport.Connection.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Close any resources used by this connection.

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.

If additional messages were produced by the remote peer, these should still be retained in the connection instance for getMessages().

AutoClosable.close() declares that it throws Exception. Implementers shouldn't throw checked exceptions. This override narrows the signature to prevent them from doing so.

Annotations
@Override
org.eclipse.jgit.transport back to summary

pack-priv Class TransportGitSsh.SshPushConnection

extends BasePackPushConnection
Class Inheritance

Field Summary

Modifier and TypeField and Description
private StreamCopyThread
private final Process
Inherited from org.eclipse.jgit.transport.BasePackPushConnection:
CAPABILITY_DELETE_REFSCAPABILITY_OFS_DELTACAPABILITY_PUSH_OPTIONSCAPABILITY_REPORT_STATUSCAPABILITY_SIDE_BAND_64K

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.eclipse.jgit.transport.BasePackConnection.close.

Implements org.eclipse.jgit.transport.Connection.close.

Closes this resource, relinquishing any underlying resources.

Inherited from org.eclipse.jgit.transport.BasePackPushConnection:
doPushgetPushOptionsisUseBitmapsnoRepositorypushpush

Field Detail

errorThreadback to summary
private StreamCopyThread errorThread
processback to summary
private final Process process

Constructor Detail

SshPushConnectionback to summary
pack-priv SshPushConnection() throws TransportException

Method Detail

closeback to summary
public void close()

Overrides org.eclipse.jgit.transport.BasePackConnection.close.

Implements org.eclipse.jgit.transport.Connection.close.

Doc from org.eclipse.jgit.transport.Connection.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Close any resources used by this connection.

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.

If additional messages were produced by the remote peer, these should still be retained in the connection instance for getMessages().

AutoClosable.close() declares that it throws Exception. Implementers shouldn't throw checked exceptions. This override narrows the signature to prevent them from doing so.

Annotations
@Override