Skip to main content
SSHService provides the server-side implementation for handling Git operations initiated over SSH, including upload-pack (fetch/clone), receive-pack (push), and upload-archive operations.

SSHUploadPack

Forwards git upload-pack to Gitaly for SSH sessions. Used when users clone or fetch repositories over SSH. Streaming RPC: Both request and response are streamed.

Request

repository
Repository
required
The repository to upload pack from. Must be present in the first message
stdin
bytes
Raw data to be copied to ‘git upload-pack’ standard input
git_config_options
string[]
Parameters to use with git -c (key=value pairs)
git_protocol
string
Git protocol version to use

Response

stdout
bytes
Raw data from ‘git upload-pack’ standard output (streamed)
stderr
bytes
Raw data from ‘git upload-pack’ standard error (streamed)
exit_status
ExitStatus
Exit status of the command. Only returned when the command has finished

SSHUploadPackWithSidechannel

Forwards git upload-pack to Gitaly for SSH sessions using the sidechannel protocol. This is a more efficient implementation for large data transfers.

Request

repository
Repository
required
The repository to upload pack from
git_config_options
string[]
Parameters to use with git -c (key=value pairs)
git_protocol
string
Git protocol version to use

Response

(empty)
Empty response. Data is transferred via sidechannel

SSHReceivePack

Forwards git receive-pack to Gitaly for SSH sessions. Used when users push to repositories over SSH. Streaming RPC: Both request and response are streamed.

Request

repository
Repository
required
The repository to receive pack into. Must be present in the first message
stdin
bytes
Raw data to be copied to ‘git receive-pack’ standard input
gl_id
string
GitLab user ID. Becomes GL_ID environment variable for ‘git receive-pack’
gl_repository
string
GitLab repository identifier. Becomes GL_REPOSITORY environment variable for ‘git receive-pack’
gl_username
string
GitLab username. Becomes GL_USERNAME environment variable for ‘git receive-pack’
git_protocol
string
Git protocol version to use
git_config_options
string[]
Parameters to use with git -c (key=value pairs)

Response

stdout
bytes
Raw data from ‘git receive-pack’ standard output (streamed)
stderr
bytes
Raw data from ‘git receive-pack’ standard error (streamed)
exit_status
ExitStatus
Exit status of the command. Only returned when the command has finished

SSHUploadArchive

Forwards git upload-archive to Gitaly for SSH sessions. Used when users request repository archives over SSH. Streaming RPC: Both request and response are streamed.

Request

repository
Repository
required
The repository to upload archive from. Must be present in the first message
stdin
bytes
Raw data to be copied to ‘git upload-archive’ standard input

Response

stdout
bytes
Raw data from ‘git upload-archive’ standard output (streamed)
stderr
bytes
Raw data from ‘git upload-archive’ standard error (streamed)
exit_status
ExitStatus
Exit status of the command. Only set on the last message

Build docs developers (and LLMs) love