GITREMOTE-HELPERS(7)

๐ŸŽ€ gitremote-helpers(7) โ€” Git Manual ๐ŸŽ€

okay bestie, buckle up โ€” this is the manual page for gitremote-helpers, aka the little helper programs that talk to remote repositories for Git. โœจ

๐ŸŒธ NAME ๐ŸŒธ

gitremote-helpers โ€” helper programs to interact with remote repositories. ๐Ÿ’–

โœจ SYNOPSIS โœจ

git remote-<transport> <repository> [<URL>]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

Okay so remote helper programs are normally not used directly by end users, but Git invokes them when it needs to interact with remote repositories Git does not support natively. A given helper will implement a subset of the capabilities documented here.

When Git needs to interact with a repository using a remote helper, it spawns the helper as an independent process, sends commands to the helperโ€™s standard input, and expects results from the helperโ€™s standard output. Because a remote helper runs as an independent process from Git, there is no need to re-link Git to add a new helper, nor any need to link the helper with the implementation of Git. iconic architecture behavior, honestly ๐Ÿ’…

Every helper must support the capabilities command, which Git uses to determine what other commands the helper will accept. Those other commands can be used to discover and update remote refs, transport objects between the object database and the remote repository, and update the local object store.

Git comes with a โ€œcurlโ€ family of remote helpers, that handle various transport protocols, such as git-remote-http, git-remote-https, git-remote-ftp and git-remote-ftps. They implement the capabilities fetch, option, and push. slay ๐Ÿซถ

๐Ÿ’œ INVOCATION ๐Ÿ’œ

Remote helper programs are invoked with one or (optionally) two arguments. The first argument specifies a remote repository as in Git; it is either the name of a configured remote or a URL. The second argument specifies a URL; it is usually of the form <transport>://<address>, but any arbitrary string is possible. The GIT_DIR environment variable is set up for the remote helper and can be used to determine where to store additional data or from which directory to invoke auxiliary Git commands.

When Git encounters a URL of the form <transport>://<address>, where <transport> is a protocol that it cannot handle natively, it automatically invokes git remote-<transport> with the full URL as the second argument. If such a URL is encountered directly on the command line, the first argument is the same as the second, and if it is encountered in a configured remote, the first argument is the name of that remote.

A URL of the form <transport>::<address> explicitly instructs Git to invoke git remote-<transport> with <address> as the second argument. If such a URL is encountered directly on the command line, the first argument is <address>, and if it is encountered in a configured remote, the first argument is the name of that remote.

Additionally, when a configured remote has remote.<name>.vcs set to <transport>, Git explicitly invokes git remote-<transport> with <name> as the first argument. If set, the second argument is remote.<name>.url; otherwise, the second argument is omitted. no cap, thatโ€™s the whole routing vibe โœจ

๐ŸŒˆ INPUT FORMAT ๐ŸŒˆ

Git sends the remote helper a list of commands on standard input, one per line. The first command is always the capabilities command, in response to which the remote helper must print a list of the capabilities it supports (see below) followed by a blank line. The response to the capabilities command determines what commands Git uses in the remainder of the command stream.

The command stream is terminated by a blank line. In some cases (indicated in the documentation of the relevant commands), this blank line is followed by a payload in some other protocol (e.g., the pack protocol), while in others it indicates the end of input. tiny detail, huge consequences ๐Ÿ˜ญ

๐Ÿงš Capabilities ๐Ÿงš

Each remote helper is expected to support only a subset of commands. The operations a helper supports are declared to Git in the response to the capabilities command (see COMMANDS, below).

In the following, we list all defined capabilities and for each we list which commands a helper with that capability must provide.

๐Ÿ’… Capabilities for Pushing ๐Ÿ’…

  • connect โ€” Can attempt to connect to git receive-pack (for pushing), git upload-pack, etc for communication using gitโ€™s native packfile protocol. This requires a bidirectional, full-duplex connection.

Supported commands: connect.

  • stateless-connect โ€” Experimental; for internal use only. Can attempt to connect to a remote server for communication using gitโ€™s wire-protocol version 2. See the documentation for the stateless-connect command for more information.

Supported commands: stateless-connect.

  • push โ€” Can discover remote refs and push local commits and the history leading up to them to new or existing remote refs.

Supported commands: list for-push, push.

  • export โ€” Can discover remote refs and push specified objects from a fast-import stream to remote refs.

Supported commands: list for-push, export.

If a helper advertises connect, Git will use it if possible and fall back to another capability if the helper requests so when connecting (see the connect command under COMMANDS). When choosing between push and export, Git prefers push. Other frontends may have some other order of preference. frontends stay having opinions, we love that for them ๐Ÿฆ‹

  • no-private-update โ€” When using the refspec capability, git normally updates the private ref on successful push. This update is disabled when the remote-helper declares the capability no-private-update.

๐ŸŒธ Capabilities for Fetching ๐ŸŒธ

  • connect โ€” Can try to connect to git upload-pack (for fetching), git receive-pack, etc for communication using the Gitโ€™s native packfile protocol. This requires a bidirectional, full-duplex connection.

Supported commands: connect.

  • stateless-connect โ€” Experimental; for internal use only. Can attempt to connect to a remote server for communication using gitโ€™s wire-protocol version 2. See the documentation for the stateless-connect command for more information.

Supported commands: stateless-connect.

  • fetch โ€” Can discover remote refs and transfer objects reachable from them to the local object store.

Supported commands: list, fetch.

  • import โ€” Can discover remote refs and output objects reachable from them as a stream in fast-import format.

Supported commands: list, import.

  • check-connectivity โ€” Can guarantee that when a clone is requested, the received pack is self contained and is connected.
  • get โ€” Can use the get command to download a file from a given URI.

If a helper advertises connect, Git will use it if possible and fall back to another capability if the helper requests so when connecting (see the connect command under COMMANDS). When choosing between fetch and import, Git prefers fetch. Other frontends may have some other order of preference. same energy, different direction ๐Ÿ’š

๐ŸŽ€ Miscellaneous capabilities ๐ŸŽ€

  • option โ€” For specifying settings like verbosity (how much output to write to stderr) and depth (how much history is wanted in the case of a shallow clone) that affect how other commands are carried out.
  • refspec <refspec> โ€” For remote helpers that implement import or export, this capability allows the refs to be constrained to a private namespace, instead of writing to refs/heads or refs/remotes directly. It is recommended that all importers providing the import capability use this. Itโ€™s mandatory for export.

A helper advertising the capability refspec refs/heads/*:refs/svn/origin/branches/* is saying that, when it is asked to import refs/heads/topic, the stream it outputs will update the refs/svn/origin/branches/topic ref.

This capability can be advertised multiple times. The first applicable refspec takes precedence. The left-hand of refspecs advertised with this capability must cover all refs reported by the list command. If no refspec capability is advertised, there is an implied refspec *:*.

When writing remote-helpers for decentralized version control systems, it is advised to keep a local copy of the repository to interact with, and to let the private namespace refs point to this local repository, while the refs/remotes namespace is used to track the remote repository.

  • bidi-import โ€” This modifies the import capability. The fast-import commands cat-blob and ls can be used by remote-helpers to retrieve information about blobs and trees that already exist in fast-importโ€™s memory. This requires a channel from fast-import to the remote-helper. If it is advertised in addition to import, Git establishes a pipe from fast-import to the remote-helperโ€™s stdin. It follows that Git and fast-import are both connected to the remote-helperโ€™s stdin. Because Git can send multiple commands to the remote-helper it is required that helpers that use bidi-import buffer all import commands of a batch before sending data to fast-import. This is to prevent mixing commands and fast-import responses on the helperโ€™s stdin.
  • export-marks <file> โ€” This modifies the export capability, instructing Git to dump the internal marks table to <file> when complete. For details, read up on --export-marks=<file> in git-fast-export(1).
  • import-marks <file> โ€” This modifies the export capability, instructing Git to load the marks specified in <file> before processing any input. For details, read up on --import-marks=<file> in git-fast-export(1).
  • signed-tags โ€” This modifies the export capability, instructing Git to pass --signed-tags=verbatim to git-fast-export(1). In the absence of this capability, Git will use --signed-tags=warn-strip.
  • object-format โ€” This indicates that the helper is able to interact with the remote side using an explicit hash algorithm extension.

๐ŸŽฎ COMMANDS ๐ŸŽฎ

Okay so the caller (that's Git, bestie) feeds commands to the helper on the helper's standard input, one per line. One. Per. Line. The way that's so clean?? ๐Ÿ’…


  • capabilities โ€” lists what the helper can do, one per line, and the list ends with a blank line. Each capability can have a * in front of it, and that * means "mandatory for Git versions that use this remote helper to understand" โ€” so if Git sees a mandatory capability it doesn't recognize, that's a fatal error, no cap. ๐Ÿซถ

Support for this command is mandatory. Like, you have to have it, it's the main character.

  • list โ€” lists the refs, again one per line, in the format "<value> <name> [<attr> ...]". And what even is <value>, you ask? It can be any of these:
    • a hex sha1 hash โœจ
    • "@<dest>" for a symref
    • ":<keyword> <value>" for a key-value pair
    • "?" โ€” which literally means the helper could not get the value of the ref ๐Ÿ˜ญ

After the name comes a space-separated list of attributes, and any attributes that aren't recognized just get ignored (no drama). The whole list ends with a blank line.

Peep REF LIST ATTRIBUTES for the attributes currently defined and REF LIST KEYWORDS for the keywords currently defined, iykyk.

Supported if the helper has the "fetch" or "import" capability. ๐Ÿฆ‹

  • list for-push โ€” basically the same as list, except it's used if and only if the caller wants the resulting ref list to prep push commands. So if a helper supports both push and fetch, this is how it tells which operation the output of list is gonna be used for โ€” which can lowkey reduce the work it has to do. Efficient queen behavior. ๐Ÿ‘‘

Supported if the helper has the "push" or "export" capability.

  • option <name> <value> โ€” sets the transport helper option <name> to <value>. Then it outputs a single line with exactly one of these, no cap:
    • ok โ€” the option was successfully set ๐ŸŒธ
    • unsupported โ€” option not recognized ๐Ÿ™ˆ
    • error <msg> โ€” the option <name> is supported, but <value> isn't valid for it ๐Ÿ’€

Options should be set before other commands, and they may influence how those commands behave. So like, set them first, bestie.

See OPTIONS for the list of options that are currently defined.

Supported if the helper has the "option" capability.

  • fetch <sha1> <name> โ€” fetches the given object and writes the necessary objects into the database. Fetch commands come in a batch, one per line, terminated with a blank line. It outputs a single blank line once every fetch command in the same batch is complete. And here's the tea: only objects that were reported in the output of list with a sha1 may be fetched this way. Periodt.

It may optionally output a lock <file> line pointing at the full path of a file under $GIT_DIR/objects/pack that keeps a pack around until refs can be properly updated. The path must end with .keep. This is a mechanism for naming a <pack,idx,keep> tuple by giving only the keep component. The kept pack won't be deleted by a concurrent repack, even though its objects might not be referenced until the fetch finishes. The .keep file gets deleted when the fetch concludes. ๐Ÿงš

If option check-connectivity is requested, the helper must output connectivity-ok if the clone is self-contained and connected.

Supported if the helper has the "fetch" capability.

  • push +<src>:<dst> โ€” pushes the given local <src> commit or branch to the remote branch described by <dst>. A batch of one or more push commands is terminated with a blank line (so if there's only one reference to push, a single push command is followed by a blank line). For example โ€” get this โ€” the following would be two batches of push: the first asks the remote-helper to push the local ref master to the remote ref master and the local HEAD to the remote branch, and the second asks to push ref foo to ref bar (that's a forced update, requested by the +):
push refs/heads/master:refs/heads/master
push HEAD:refs/heads/branch
\n
push +refs/heads/foo:refs/heads/bar
\n

Zero or more protocol options may be entered after the last push command, before the batch's terminating blank line. Slay.

When the push is complete, it outputs one or more ok <dst> or error <dst> <why>? lines to show success or failure for each pushed ref. The status report output is terminated by a blank line. And the option field <why> may be quoted in a C style string if it contains an LF. ๐Ÿ’…

Supported if the helper has the "push" capability.

  • import <name> โ€” produces a fast-import stream that imports the current value of the named ref. It may additionally import other refs as needed to construct the history efficiently. The script writes to a helper-specific private namespace, and the value of the named ref should be written to a location in that namespace derived by applying the refspecs from the "refspec" capability to the name of the ref.

Especially useful for interoperability with a foreign versioning system. ๐Ÿฆ‹

Just like push, a batch of one or more import is terminated with a blank line. For each batch of import, the remote helper should produce a fast-import stream terminated by a done command.

Heads up bestie: if the bidi-import capability is used, the complete batch sequence has to be buffered before starting to send data to fast-import โ€” otherwise you get commands and fast-import responses mixing on the helper's stdin and that's a whole mess. ๐Ÿ˜ญ

Supported if the helper has the "import" capability.

  • export โ€” tells the remote helper that any subsequent input is part of a fast-import stream (generated by git fast-export) containing objects that should be pushed to the remote. ๐Ÿ“ค

Especially useful for interoperability with a foreign versioning system. (yes, same energy, iconic)

The export-marks and import-marks capabilities, if specified, affect this command in that they're passed on to git fast-export, which will then load/store a table of marks for local objects. This can be used to implement incremental operations. โœจ

Supported if the helper has the "export" capability.

  • connect <service> โ€” connects to the given service. The helper's standard input and standard output get connected to the specified service on the remote side (the git prefix is included in the service name, so for example fetching uses git-upload-pack as the service). Valid replies to this command:
    • an empty line โ†’ connection established ๐ŸŽ€
    • fallback โ†’ no smart transport support, so fall back to dumb transports
    • just exiting with an error message printed โ†’ can't connect, don't even bother trying to fall back ๐Ÿ’€

After the line feed terminating the positive (empty) response, the output of the service starts. And after the connection ends, the remote helper exits. Bye bestie ๐Ÿ‘‹

Supported if the helper has the "connect" capability.

  • stateless-connect <service> โ€” Experimental; for internal use only. ๐Ÿ™ˆ Connects to the given remote service for communication using Git's wire-protocol version 2. Valid replies are the same trio: an empty line (connection established), fallback (no smart transport support, fall back to dumb transports), and just exiting with an error message printed (can't connect, don't bother trying to fall back). After the line feed terminating the positive (empty) response, the output of the service starts.

Messages (both request and response) must consist of zero or more PKT-LINEs, terminating in a flush packet. Response messages will then have a response end packet after the flush packet to indicate the end of a response. The client must not expect the server to store any state in between request-response pairs. After the connection ends, the remote helper exits.

Supported if the helper has the "stateless-connect" capability.

  • get <uri> <path> โ€” downloads the file from the given <uri> to the given <path>. And here's a cute little detail: if <path>.temp exists, Git assumes that .temp file is a partial download from a previous attempt and will resume the download from that position. Resumable downloads, we love to see it. ๐Ÿซถ

If a fatal error occurs, the program writes the error message to stderr and exits. The caller should expect that a suitable error message has been printed if the child closes the connection without completing a valid response for the current command. So like, no silent ghosting. ๐Ÿ˜ค

Additional commands may also be supported โ€” that's determined from the capabilities reported by the helper. โœจ


๐ŸŒˆ REF LIST ATTRIBUTES ๐ŸŒˆ

So the list command produces a list of refs, and each ref may be followed by a list of attributes. These are the ref list attributes that are currently defined:

  • unchanged โ€” this ref is unchanged since the last import or fetch, although the helper can't necessarily determine what value that produced. ๐Ÿ‘‘ (like, it's the same, but don't ask it to prove it)

๐ŸŽ€ REF LIST KEYWORDS ๐ŸŽ€

And the list command may also produce a list of key-value pairs. These keys are the ones currently defined:

  • object-format โ€” the refs are using the given hash algorithm. This keyword is only used if the server and the client both support the object-format extension. ๐Ÿค

โœจ OPTIONS โœจ

okay so these are the options Git itself defines โ€” and it only sets them if your remote helper has the option capability. no capability, no options, no vibes. ๐Ÿซถ

  • option verbosity <n> โ€” changes how chatty the helper's messages are. <n> of 0 means everything runs quietly and the helper only spits out error output. 1 is the default level of verbosity, and higher values of <n> line up with the number of -v flags passed on the command line. so like, -v -v -v = <n> of 3, iykyk ๐Ÿ’…
  • option progress {true|false} โ€” turns progress messages on (or off) while the transport helper is doing a command. yes bestie we love a little loading bar moment ๐ŸŒธ
  • option depth <depth> โ€” deepens the history of a shallow repository.
  • option deepen-since <timestamp> โ€” deepens the history of a shallow repository, but based on time. โฐ
  • option deepen-not <ref> โ€” deepens the history of a shallow repository while excluding ref. and no cap, multiple of these options add up โ€” they stack. ๐Ÿงš
  • option deepen-relative {true|false} โ€” deepens the history of a shallow repository relative to the current boundary. only valid when used with option depth, so don't be out here using it solo ๐Ÿ™ˆ
  • option followtags {true|false} โ€” if enabled, the helper should automatically fetch annotated tag objects when the object the tag points at got transferred during the fetch command. if the helper doesn't fetch the tag, a second fetch command will usually be sent to ask for that tag specifically. some helpers can use this option to dodge a whole second network connection โ€” icon behaviour, honestly ๐Ÿ‘‘
  • option dry-run {true|false} โ€” if true, pretend the operation completed successfully, but don't actually change any repository data. for most helpers this only applies to the push, if supported. fake it till you make it, but make it fake ๐Ÿ’€
  • option servpath <c-style-quoted-path> โ€” sets the service path (--upload-pack, --receive-pack, etc.) for the next connect. a remote helper may support this option, but it must not rely on this option being set before the connect request occurs. read that again: must not rely ๐Ÿซถ
  • option check-connectivity {true|false} โ€” asks the helper to check connectivity of a clone.
  • option force {true|false} โ€” asks the helper to perform a force update. defaults to false. โœจ
  • option cloning {true|false} โ€” lets the helper know this is a clone request, i.e. the current repository is guaranteed empty. fresh start energy ๐ŸŽ€
  • option update-shallow {true|false} โ€” allows extending .git/shallow if the new refs require it.
  • option pushcert {true|false} โ€” GPG sign pushes. ๐Ÿ”ฅ
  • option push-option <string> โ€” transmits <string> as a push option. since the push option must not contain LF or NUL characters, the string is not encoded. so like, don't sneak a newline in there, bestie ๐Ÿ˜ญ
  • option from-promisor {true|false} โ€” indicates that these objects are being fetched from a promisor.
  • option no-dependents {true|false} โ€” indicates that only the objects wanted need to be fetched, not their dependents.
  • option atomic {true|false} โ€” when pushing, requests that the remote server update refs in a single atomic transaction. if it works, all refs get updated, or none do. if the remote side doesn't support this capability, the push will fail. all-or-nothing, main character energy โญ
  • option object-format true โ€” indicates that the caller wants hash algorithm information passed back from the remote. this mode is used when fetching refs. (notice it's just true here โ€” that's the only value listed, so don't improvise ๐ŸŒˆ)

๐ŸŒธ SEE ALSO ๐ŸŒธ


๐Ÿ’– GIT ๐Ÿ’–

part of the git(1) suite. one big happy family ๐Ÿซถ


and that's a wrap on the whole page, bestie!! ๐ŸŽ€ this was written up as part of Git 2.56.0, dated 2026-09-27, and it lives at GITREMOTE-HELPERS(7) โ€” like, that's literally the whole footer, go off ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from