The SFTP transport does not require any specialized Git support on the remote (server side) repository. Object files are retrieved directly through secure shell's FTP protocol, making it possible to copy objects from a remote repository that is available over SSH, but whose remote host does not have Git installed.
Unlike the HTTP variant (see
org.) we rely upon being able to
list files in directories, as the SFTP protocol supports this function. By
listing files through SFTP we can avoid needing to have current
objects/info/packs or info/refs files on the remote
repository and access the data directly, much as Git itself would.
Concurrent pushing over this transport is not supported. Multiple concurrent push operations may cause confusion in the repository state.
WalkFetchConnection
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final TransportProtocol |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv FtpChannel | |
| public FetchConnection | openFetch()
Implements abstract org. Begins a new connection for fetching from the remote repository. |
| public PushConnection | openPush()
Implements abstract org. Begins a new connection for pushing into the remote repository. |
| PROTO_SFTP | back to summary |
|---|---|
| pack-priv static final TransportProtocol PROTO_SFTP | |
| TransportSftp | back to summary |
|---|---|
| pack-priv TransportSftp(Repository local, URIish uri) | |
| newSftp | back to summary |
|---|---|
| pack-priv FtpChannel newSftp() throws IOException | |
| openFetch | back to summary |
|---|---|
| public FetchConnection openFetch() throws TransportException Implements abstract org. Doc from org. 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.
| |
| openPush | back to summary |
|---|---|
| public PushConnection openPush() throws TransportException Implements abstract org. Doc from org. Begins a new connection for pushing into the remote repository.
| |
| Modifier and Type | Field and Description |
|---|---|
| private FtpChannel | |
| private final String |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | close()
Implements abstract org. Close any resources used by this connection. |
| pack-priv void | deleteFile(String
name of the item to be removed, relative to the current object
database. path)Overrides org. Delete a file from the object database. |
| pack-priv Collection | getAlternates()
Implements abstract org. Obtain alternate connections to alternate object databases (if any). |
| pack-priv Collection | getPackNames()
Implements abstract org. Obtain the list of available packs (if any). |
| pack-priv URIish | |
| private Ref. | |
| private void | |
| pack-priv WalkRemoteObjectDatabase. | open(String
location of the file to read, relative to this objects
directory (e.g.
path)cb/95df6ab7ae9e57571511ef451cf33767c26dd2 or
pack/pack-035760ab452d6eebd123add421f253ce7682355a.pack).Implements abstract org. Open a single file for reading. |
| pack-priv WalkRemoteObjectDatabase | openAlternate(String
the location of the new alternate, relative to the current
object database. location)Implements abstract org. Create a new connection for a discovered alternate object database
This method is typically called by |
| pack-priv Map | |
| private void | |
| private Ref | |
| pack-priv OutputStream | writeFile(String
name of the file to write, relative to the current object
database. path, ProgressMonitor (optional) progress monitor to post write completion to during
the stream's close method. monitor, String (optional) task name to display during the close method. monitorTask)Overrides org. Open a remote file for writing. |
| pack-priv void | writeFile(String
name of the file to write, relative to the current object
database. path, byte[] complete new content of the file. data)Overrides org. Atomically write a remote file. |
| ftp | back to summary |
|---|---|
| private FtpChannel ftp | |
| objectsPath | back to summary |
|---|---|
| private final String objectsPath | |
| SftpObjectDB | back to summary |
|---|---|
| pack-priv SftpObjectDB(String path) throws TransportException | |
| SftpObjectDB | back to summary |
|---|---|
| pack-priv SftpObjectDB(TransportSftp. | |
| close | back to summary |
|---|---|
| pack-priv void close() Implements abstract org. Doc from org. 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.
| |
| deleteFile | back to summary |
|---|---|
| pack-priv void deleteFile(String path) throws IOException Overrides org. Doc from org. Delete a file from the object database.
Path may start with When possible empty directories must be removed, up to but not including the current object database directory itself. This method does not support deletion of directories.
| |
| getAlternates | back to summary |
|---|---|
| pack-priv Collection Implements abstract org. Doc from org. Obtain alternate connections to alternate object databases (if any).
Alternates are typically read from the file
Alternates may reuse the same network connection handle, however the
fetch connection will
| |
| getPackNames | back to summary |
|---|---|
| pack-priv Collection Implements abstract org. Doc from org. Obtain the list of available packs (if any).
Pack names should be the file name in the packs directory, that is
| |
| getURI | back to summary |
|---|---|
| pack-priv URIish getURI() Implements abstract org.
| |
| loose | back to summary |
|---|---|
| private Ref. | |
| mkdir_p | back to summary |
|---|---|
| private void mkdir_p(String path) throws IOException | |
| open | back to summary |
|---|---|
| pack-priv WalkRemoteObjectDatabase. Implements abstract org. Doc from org. Open a single file for reading.
Implementors should make every attempt possible to ensure
This method is recommended for already compressed files like loose objects
and pack files. For text files, see
| |
| openAlternate | back to summary |
|---|---|
| pack-priv WalkRemoteObjectDatabase openAlternate(String location) throws IOException Implements abstract org. Doc from org. Create a new connection for a discovered alternate object database
This method is typically called by
| |
| readAdvertisedRefs | back to summary |
|---|---|
| pack-priv Map | |
| readLooseRefs | back to summary |
|---|---|
| private void readLooseRefs(TreeMap<String, Ref> avail, String dir, String prefix) throws TransportException | |
| readRef | back to summary |
|---|---|
| private Ref readRef(TreeMap<String, Ref> avail, String path, String name) throws TransportException | |
| writeFile | back to summary |
|---|---|
| pack-priv OutputStream writeFile(String path, ProgressMonitor monitor, String monitorTask) throws IOException Overrides org. Doc from org. Open a remote file for writing.
Path may start with The requested path may or may not exist. If the path already exists as a file the file should be truncated and completely replaced. This method creates any missing parent directories, if necessary.
| |
| writeFile | back to summary |
|---|---|
| pack-priv void writeFile(String path, byte[] data) throws IOException Overrides org. Doc from org. Atomically write a remote file. This method attempts to perform as atomic of an update as it can, reducing (or eliminating) the time that clients might be able to see partial file content. This method is not suitable for very large transfers as the complete content must be passed as an argument.
Path may start with The requested path may or may not exist. If the path already exists as a file the file should be truncated and completely replaced. This method creates any missing parent directories, if necessary.
| |