1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
\r
4 <sect2 lang="en" id="git-remote-helpers(1)">
\r
5 <title>git-remote-helpers(1)</title>
\r
7 <primary>git-remote-helpers(1)</primary>
\r
9 <simplesect id="git-remote-helpers(1)__name">
\r
11 <simpara>git-remote-helpers - Helper programs to interact with remote repositories</simpara>
\r
13 <simplesect id="git-remote-helpers(1)__synopsis">
\r
14 <title>SYNOPSIS</title>
\r
16 <literallayout><emphasis>git remote-<transport></emphasis> <repository> [<URL>]</literallayout>
\r
19 <simplesect id="git-remote-helpers(1)__description">
\r
20 <title>DESCRIPTION</title>
\r
21 <simpara>Remote helper programs are normally not used directly by end users,
\r
22 but they are invoked by git when it needs to interact with remote
\r
23 repositories git does not support natively. A given helper will
\r
24 implement a subset of the capabilities documented here. When git
\r
25 needs to interact with a repository using a remote helper, it spawns
\r
26 the helper as an independent process, sends commands to the helper's
\r
27 standard input, and expects results from the helper's standard
\r
28 output. Because a remote helper runs as an independent process from
\r
29 git, there is no need to re-link git to add a new helper, nor any
\r
30 need to link the helper with the implementation of git.</simpara>
\r
31 <simpara>Every helper must support the "capabilities" command, which git
\r
32 uses to determine what other commands the helper will accept. Those
\r
33 other commands can be used to discover and update remote refs,
\r
34 transport objects between the object database and the remote repository,
\r
35 and update the local object store.</simpara>
\r
36 <simpara>Git comes with a "curl" family of remote helpers, that handle various
\r
37 transport protocols, such as <emphasis>git-remote-http</emphasis>, <emphasis>git-remote-https</emphasis>,
\r
38 <emphasis>git-remote-ftp</emphasis> and <emphasis>git-remote-ftps</emphasis>. They implement the capabilities
\r
39 <emphasis>fetch</emphasis>, <emphasis>option</emphasis>, and <emphasis>push</emphasis>.</simpara>
\r
41 <simplesect id="git-remote-helpers(1)__invocation">
\r
42 <title>INVOCATION</title>
\r
43 <simpara>Remote helper programs are invoked with one or (optionally) two
\r
44 arguments. The first argument specifies a remote repository as in git;
\r
45 it is either the name of a configured remote or a URL. The second
\r
46 argument specifies a URL; it is usually of the form
\r
47 <emphasis><transport>://<address></emphasis>, but any arbitrary string is possible.
\r
48 The <emphasis>GIT_DIR</emphasis> environment variable is set up for the remote helper
\r
49 and can be used to determine where to store additional data or from
\r
50 which directory to invoke auxiliary git commands.</simpara>
\r
51 <simpara>When git encounters a URL of the form <emphasis><transport>://<address></emphasis>, where
\r
52 <emphasis><transport></emphasis> is a protocol that it cannot handle natively, it
\r
53 automatically invokes <emphasis>git remote-<transport></emphasis> with the full URL as
\r
54 the second argument. If such a URL is encountered directly on the
\r
55 command line, the first argument is the same as the second, and if it
\r
56 is encountered in a configured remote, the first argument is the name
\r
57 of that remote.</simpara>
\r
58 <simpara>A URL of the form <emphasis><transport>::<address></emphasis> explicitly instructs git to
\r
59 invoke <emphasis>git remote-<transport></emphasis> with <emphasis><address></emphasis> as the second
\r
60 argument. If such a URL is encountered directly on the command line,
\r
61 the first argument is <emphasis><address></emphasis>, and if it is encountered in a
\r
62 configured remote, the first argument is the name of that remote.</simpara>
\r
63 <simpara>Additionally, when a configured remote has <emphasis>remote.<name>.vcs</emphasis> set to
\r
64 <emphasis><transport></emphasis>, git explicitly invokes <emphasis>git remote-<transport></emphasis> with
\r
65 <emphasis><name></emphasis> as the first argument. If set, the second argument is
\r
66 <emphasis>remote.<name>.url</emphasis>; otherwise, the second argument is omitted.</simpara>
\r
68 <simplesect id="git-remote-helpers(1)__input_format">
\r
69 <title>INPUT FORMAT</title>
\r
70 <simpara>Git sends the remote helper a list of commands on standard input, one
\r
71 per line. The first command is always the <emphasis>capabilities</emphasis> command, in
\r
72 response to which the remote helper must print a list of the
\r
73 capabilities it supports (see below) followed by a blank line. The
\r
74 response to the capabilities command determines what commands Git uses
\r
75 in the remainder of the command stream.</simpara>
\r
76 <simpara>The command stream is terminated by a blank line. In some cases
\r
77 (indicated in the documentation of the relevant commands), this blank
\r
78 line is followed by a payload in some other protocol (e.g., the pack
\r
79 protocol), while in others it indicates the end of input.</simpara>
\r
80 <section id="git-remote-helpers(1)__capabilities">
\r
81 <title>Capabilities</title>
\r
82 <simpara>Each remote helper is expected to support only a subset of commands.
\r
83 The operations a helper supports are declared to git in the response
\r
84 to the <emphasis>capabilities</emphasis> command (see COMMANDS, below).</simpara>
\r
85 <simpara>In the following, we list all defined capabilities and for
\r
86 each we list which commands a helper with that capability
\r
87 must provide.</simpara>
\r
88 <section id="git-remote-helpers(1)__capabilities_for_pushing">
\r
89 <title>Capabilities for Pushing</title>
\r
93 <emphasis>connect</emphasis>
\r
97 Can attempt to connect to <emphasis>git receive-pack</emphasis> (for pushing),
\r
98 <emphasis>git upload-pack</emphasis>, etc for communication using
\r
99 git's native packfile protocol. This
\r
100 requires a bidirectional, full-duplex connection.
\r
102 <simpara>Supported commands: <emphasis>connect</emphasis>.</simpara>
\r
107 <emphasis>push</emphasis>
\r
111 Can discover remote refs and push local commits and the
\r
112 history leading up to them to new or existing remote refs.
\r
114 <simpara>Supported commands: <emphasis>list for-push</emphasis>, <emphasis>push</emphasis>.</simpara>
\r
119 <emphasis>export</emphasis>
\r
123 Can discover remote refs and push specified objects from a
\r
124 fast-import stream to remote refs.
\r
126 <simpara>Supported commands: <emphasis>list for-push</emphasis>, <emphasis>export</emphasis>.</simpara>
\r
130 <simpara>If a helper advertises <emphasis>connect</emphasis>, git will use it if possible and
\r
131 fall back to another capability if the helper requests so when
\r
132 connecting (see the <emphasis>connect</emphasis> command under COMMANDS).
\r
133 When choosing between <emphasis>push</emphasis> and <emphasis>export</emphasis>, git prefers <emphasis>push</emphasis>.
\r
134 Other frontends may have some other order of preference.</simpara>
\r
136 <section id="git-remote-helpers(1)__capabilities_for_fetching">
\r
137 <title>Capabilities for Fetching</title>
\r
141 <emphasis>connect</emphasis>
\r
145 Can try to connect to <emphasis>git upload-pack</emphasis> (for fetching),
\r
146 <emphasis>git receive-pack</emphasis>, etc for communication using the
\r
147 git's native packfile protocol. This
\r
148 requires a bidirectional, full-duplex connection.
\r
150 <simpara>Supported commands: <emphasis>connect</emphasis>.</simpara>
\r
155 <emphasis>fetch</emphasis>
\r
159 Can discover remote refs and transfer objects reachable from
\r
160 them to the local object store.
\r
162 <simpara>Supported commands: <emphasis>list</emphasis>, <emphasis>fetch</emphasis>.</simpara>
\r
167 <emphasis>import</emphasis>
\r
171 Can discover remote refs and output objects reachable from
\r
172 them as a stream in fast-import format.
\r
174 <simpara>Supported commands: <emphasis>list</emphasis>, <emphasis>import</emphasis>.</simpara>
\r
178 <simpara>If a helper advertises <emphasis>connect</emphasis>, git will use it if possible and
\r
179 fall back to another capability if the helper requests so when
\r
180 connecting (see the <emphasis>connect</emphasis> command under COMMANDS).
\r
181 When choosing between <emphasis>fetch</emphasis> and <emphasis>import</emphasis>, git prefers <emphasis>fetch</emphasis>.
\r
182 Other frontends may have some other order of preference.</simpara>
\r
184 <section id="git-remote-helpers(1)__miscellaneous_capabilities">
\r
185 <title>Miscellaneous capabilities</title>
\r
189 <emphasis>option</emphasis>
\r
193 For specifying settings like <emphasis>verbosity</emphasis> (how much output to
\r
194 write to stderr) and <emphasis>depth</emphasis> (how much history is wanted in the
\r
195 case of a shallow clone) that affect how other commands are
\r
202 <emphasis>refspec</emphasis> <refspec>
\r
206 This modifies the <emphasis>import</emphasis> capability, allowing the produced
\r
207 fast-import stream to modify refs in a private namespace
\r
208 instead of writing to refs/heads or refs/remotes directly.
\r
209 It is recommended that all importers providing the <emphasis>import</emphasis>
\r
210 capability use this.
\r
212 <simpara>A helper advertising the capability
\r
213 <emphasis>refspec refs/heads/*:refs/svn/origin/branches/*</emphasis>
\r
214 is saying that, when it is asked to <emphasis>import refs/heads/topic</emphasis>, the
\r
215 stream it outputs will update the <emphasis>refs/svn/origin/branches/topic</emphasis>
\r
217 <simpara>This capability can be advertised multiple times. The first
\r
218 applicable refspec takes precedence. The left-hand of refspecs
\r
219 advertised with this capability must cover all refs reported by
\r
220 the list command. If no <emphasis>refspec</emphasis> capability is advertised,
\r
221 there is an implied <emphasis>refspec *:*</emphasis>.</simpara>
\r
226 <emphasis>bidi-import</emphasis>
\r
230 This modifies the <emphasis>import</emphasis> capability.
\r
231 The fast-import commands <emphasis>cat-blob</emphasis> and <emphasis>ls</emphasis> can be used by remote-helpers
\r
232 to retrieve information about blobs and trees that already exist in
\r
233 fast-import's memory. This requires a channel from fast-import to the
\r
235 If it is advertised in addition to "import", git establishes a pipe from
\r
236 fast-import to the remote-helper's stdin.
\r
237 It follows that git and fast-import are both connected to the
\r
238 remote-helper's stdin. Because git can send multiple commands to
\r
239 the remote-helper it is required that helpers that use <emphasis>bidi-import</emphasis>
\r
240 buffer all <emphasis>import</emphasis> commands of a batch before sending data to fast-import.
\r
241 This is to prevent mixing commands and fast-import responses on the
\r
248 <emphasis>export-marks</emphasis> <file>
\r
252 This modifies the <emphasis>export</emphasis> capability, instructing git to dump the
\r
253 internal marks table to <file> when complete. For details,
\r
254 read up on <emphasis>--export-marks=<file></emphasis> in <xref linkend="git-fast-export(1)" />.
\r
260 <emphasis>import-marks</emphasis> <file>
\r
264 This modifies the <emphasis>export</emphasis> capability, instructing git to load the
\r
265 marks specified in <file> before processing any input. For details,
\r
266 read up on <emphasis>--import-marks=<file></emphasis> in <xref linkend="git-fast-export(1)" />.
\r
274 <simplesect id="git-remote-helpers(1)__commands">
\r
275 <title>COMMANDS</title>
\r
276 <simpara>Commands are given by the caller on the helper's standard input, one per line.</simpara>
\r
280 <emphasis>capabilities</emphasis>
\r
284 Lists the capabilities of the helper, one per line, ending
\r
285 with a blank line. Each capability may be preceded with <emphasis>*</emphasis>,
\r
286 which marks them mandatory for git versions using the remote
\r
287 helper to understand. Any unknown mandatory capability is a
\r
290 <simpara>Support for this command is mandatory.</simpara>
\r
295 <emphasis>list</emphasis>
\r
299 Lists the refs, one per line, in the format "<value> <name>
\r
300 [<attr> …]". The value may be a hex sha1 hash, "@<dest>" for
\r
301 a symref, or "?" to indicate that the helper could not get the
\r
302 value of the ref. A space-separated list of attributes follows
\r
303 the name; unrecognized attributes are ignored. The list ends
\r
306 <simpara>See REF LIST ATTRIBUTES for a list of currently defined attributes.</simpara>
\r
307 <simpara>Supported if the helper has the "fetch" or "import" capability.</simpara>
\r
312 <emphasis>list for-push</emphasis>
\r
316 Similar to <emphasis>list</emphasis>, except that it is used if and only if
\r
317 the caller wants to the resulting ref list to prepare
\r
319 A helper supporting both push and fetch can use this
\r
320 to distinguish for which operation the output of <emphasis>list</emphasis>
\r
321 is going to be used, possibly reducing the amount
\r
322 of work that needs to be performed.
\r
324 <simpara>Supported if the helper has the "push" or "export" capability.</simpara>
\r
329 <emphasis>option</emphasis> <name> <value>
\r
333 Sets the transport helper option <name> to <value>. Outputs a
\r
334 single line containing one of <emphasis>ok</emphasis> (option successfully set),
\r
335 <emphasis>unsupported</emphasis> (option not recognized) or <emphasis>error <msg></emphasis>
\r
336 (option <name> is supported but <value> is not valid
\r
337 for it). Options should be set before other commands,
\r
338 and may influence the behavior of those commands.
\r
340 <simpara>See OPTIONS for a list of currently defined options.</simpara>
\r
341 <simpara>Supported if the helper has the "option" capability.</simpara>
\r
346 <emphasis>fetch</emphasis> <sha1> <name>
\r
350 Fetches the given object, writing the necessary objects
\r
351 to the database. Fetch commands are sent in a batch, one
\r
352 per line, terminated with a blank line.
\r
353 Outputs a single blank line when all fetch commands in the
\r
354 same batch are complete. Only objects which were reported
\r
355 in the output of <emphasis>list</emphasis> with a sha1 may be fetched this way.
\r
357 <simpara>Optionally may output a <emphasis>lock <file></emphasis> line indicating a file under
\r
358 GIT_DIR/objects/pack which is keeping a pack until refs can be
\r
359 suitably updated.</simpara>
\r
360 <simpara>Supported if the helper has the "fetch" capability.</simpara>
\r
365 <emphasis>push</emphasis> +<src>:<dst>
\r
369 Pushes the given local <src> commit or branch to the
\r
370 remote branch described by <dst>. A batch sequence of
\r
371 one or more <emphasis>push</emphasis> commands is terminated with a blank line
\r
372 (if there is only one reference to push, a single <emphasis>push</emphasis> command
\r
373 is followed by a blank line). For example, the following would
\r
374 be two batches of <emphasis>push</emphasis>, the first asking the remote-helper
\r
375 to push the local ref <emphasis>master</emphasis> to the remote ref <emphasis>master</emphasis> and
\r
376 the local <emphasis>HEAD</emphasis> to the remote <emphasis>branch</emphasis>, and the second
\r
377 asking to push ref <emphasis>foo</emphasis> to ref <emphasis>bar</emphasis> (forced update requested
\r
378 by the <emphasis>+</emphasis>).
\r
380 <screen>push refs/heads/master:refs/heads/master
\r
381 push HEAD:refs/heads/branch
\r
383 push +refs/heads/foo:refs/heads/bar
\r
385 <simpara>Zero or more protocol options may be entered after the last <emphasis>push</emphasis>
\r
386 command, before the batch's terminating blank line.</simpara>
\r
387 <simpara>When the push is complete, outputs one or more <emphasis>ok <dst></emphasis> or
\r
388 <emphasis>error <dst> <why>?</emphasis> lines to indicate success or failure of
\r
389 each pushed ref. The status report output is terminated by
\r
390 a blank line. The option field <why> may be quoted in a C
\r
391 style string if it contains an LF.</simpara>
\r
392 <simpara>Supported if the helper has the "push" capability.</simpara>
\r
397 <emphasis>import</emphasis> <name>
\r
401 Produces a fast-import stream which imports the current value
\r
402 of the named ref. It may additionally import other refs as
\r
403 needed to construct the history efficiently. The script writes
\r
404 to a helper-specific private namespace. The value of the named
\r
405 ref should be written to a location in this namespace derived
\r
406 by applying the refspecs from the "refspec" capability to the
\r
409 <simpara>Especially useful for interoperability with a foreign versioning
\r
411 <simpara>Just like <emphasis>push</emphasis>, a batch sequence of one or more <emphasis>import</emphasis> is
\r
412 terminated with a blank line. For each batch of <emphasis>import</emphasis>, the remote
\r
413 helper should produce a fast-import stream terminated by a <emphasis>done</emphasis>
\r
415 <simpara>Note that if the <emphasis>bidi-import</emphasis> capability is used the complete batch
\r
416 sequence has to be buffered before starting to send data to fast-import
\r
417 to prevent mixing of commands and fast-import responses on the helper's
\r
419 <simpara>Supported if the helper has the "import" capability.</simpara>
\r
424 <emphasis>export</emphasis>
\r
428 Instructs the remote helper that any subsequent input is
\r
429 part of a fast-import stream (generated by <emphasis>git fast-export</emphasis>)
\r
430 containing objects which should be pushed to the remote.
\r
432 <simpara>Especially useful for interoperability with a foreign versioning
\r
434 <simpara>The <emphasis>export-marks</emphasis> and <emphasis>import-marks</emphasis> capabilities, if specified,
\r
435 affect this command in so far as they are passed on to <emphasis>git
\r
436 fast-export</emphasis>, which then will load/store a table of marks for
\r
437 local objects. This can be used to implement for incremental
\r
438 operations.</simpara>
\r
439 <simpara>Supported if the helper has the "export" capability.</simpara>
\r
444 <emphasis>connect</emphasis> <service>
\r
448 Connects to given service. Standard input and standard output
\r
449 of helper are connected to specified service (git prefix is
\r
450 included in service name so e.g. fetching uses <emphasis>git-upload-pack</emphasis>
\r
451 as service) on remote side. Valid replies to this command are
\r
452 empty line (connection established), <emphasis>fallback</emphasis> (no smart
\r
453 transport support, fall back to dumb transports) and just
\r
454 exiting with error message printed (can't connect, don't
\r
455 bother trying to fall back). After line feed terminating the
\r
456 positive (empty) response, the output of service starts. After
\r
457 the connection ends, the remote helper exits.
\r
459 <simpara>Supported if the helper has the "connect" capability.</simpara>
\r
463 <simpara>If a fatal error occurs, the program writes the error message to
\r
464 stderr and exits. The caller should expect that a suitable error
\r
465 message has been printed if the child closes the connection without
\r
466 completing a valid response for the current command.</simpara>
\r
467 <simpara>Additional commands may be supported, as may be determined from
\r
468 capabilities reported by the helper.</simpara>
\r
470 <simplesect id="git-remote-helpers(1)__ref_list_attributes">
\r
471 <title>REF LIST ATTRIBUTES</title>
\r
472 <simpara>The <emphasis>list</emphasis> command produces a list of refs in which each ref
\r
473 may be followed by a list of attributes. The following ref list
\r
474 attributes are defined.</simpara>
\r
478 <emphasis>unchanged</emphasis>
\r
482 This ref is unchanged since the last import or fetch, although
\r
483 the helper cannot necessarily determine what value that produced.
\r
489 <simplesect id="git-remote-helpers(1)__options">
\r
490 <title>OPTIONS</title>
\r
491 <simpara>The following options are defined and (under suitable circumstances)
\r
492 set by git if the remote helper has the <emphasis>option</emphasis> capability.</simpara>
\r
496 <emphasis>option verbosity</emphasis> <n>
\r
500 Changes the verbosity of messages displayed by the helper.
\r
501 A value of 0 for <n> means that processes operate
\r
502 quietly, and the helper produces only error output.
\r
503 1 is the default level of verbosity, and higher values
\r
504 of <n> correspond to the number of -v flags passed on the
\r
511 <emphasis>option progress</emphasis> {<emphasis>true</emphasis>|<emphasis>false</emphasis>}
\r
515 Enables (or disables) progress messages displayed by the
\r
516 transport helper during a command.
\r
522 <emphasis>option depth</emphasis> <depth>
\r
526 Deepens the history of a shallow repository.
\r
532 <emphasis>option followtags</emphasis> {<emphasis>true</emphasis>|<emphasis>false</emphasis>}
\r
536 If enabled the helper should automatically fetch annotated
\r
537 tag objects if the object the tag points at was transferred
\r
538 during the fetch command. If the tag is not fetched by
\r
539 the helper a second fetch command will usually be sent to
\r
540 ask for the tag specifically. Some helpers may be able to
\r
541 use this option to avoid a second network connection.
\r
546 <simpara><emphasis>option dry-run</emphasis> {<emphasis>true</emphasis>|<emphasis>false</emphasis>}:
\r
547 If true, pretend the operation completed successfully,
\r
548 but don't actually change any repository data. For most
\r
549 helpers this only applies to the <emphasis>push</emphasis>, if supported.</simpara>
\r
553 <emphasis>option servpath <c-style-quoted-path></emphasis>
\r
557 Sets service path (--upload-pack, --receive-pack etc.) for
\r
558 next connect. Remote helper may support this option, but
\r
559 must not rely on this option being set before
\r
560 connect request occurs.
\r
566 <simplesect id="git-remote-helpers(1)__see_also">
\r
567 <title>SEE ALSO</title>
\r
568 <simpara><xref linkend="git-remote(1)" /></simpara>
\r
569 <simpara><xref linkend="git-remote-testgit(1)" /></simpara>
\r
571 <simplesect id="git-remote-helpers(1)__git">
\r
573 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
\r