Skip to main content
SmartHTTPService provides the server-side implementation of Git’s Smart HTTP protocol, handling both upload-pack (fetch/clone) and receive-pack (push) operations.

InfoRefsUploadPack

Provides the response body for GET /info/refs?service=git-upload-pack. Invoked when the user executes a git fetch, meaning the server will upload the packs to that user. The user doesn’t upload new objects.

Request

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

Response

data
bytes
Raw reference data in git-upload-pack format (streamed)

InfoRefsReceivePack

Provides the response body for GET /info/refs?service=git-receive-pack. Invoked when the user executes a git push, but only advertises references to the user.

Request

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

Response

data
bytes
Raw reference data in git-receive-pack format (streamed)

PostUploadPack

Handles request and response body for POST /upload-pack. Used for git fetch and clone operations. Streaming RPC: Both request and response are streamed for handling large pack files.

Request

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

Response

data
bytes
Raw data from stdout of ‘git upload-pack’ (streamed)

PostUploadPackWithSidechannel

Handles request and response body for POST /upload-pack 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

PostReceivePack

Handles request and response body for POST /receive-pack. Used for git push operations. Streaming RPC: Both request and response are streamed for handling large pack files.

Request

repository
Repository
required
The repository to receive pack into. Should only be present in the first message
data
bytes
Raw data to be copied to stdin of ‘git receive-pack’
gl_id
string
GitLab user ID. Becomes env variable used by Git pre-receive and post-receive hooks. Should only be present in the first message
gl_repository
string
GitLab repository identifier. Becomes env variable used by Git hooks. Should only be present in the first message
gl_username
string
GitLab username. Becomes env variable used by Git hooks. Should only be present in the first message
git_protocol
string
Git protocol version to use
git_config_options
string[]
Parameters to use with git -c (key=value pairs)

Response

data
bytes
Raw data from stdout of ‘git receive-pack’ (streamed)

Build docs developers (and LLMs) love