6 git-remote-helpers - Helper programs to interact with remote repositories
10 'git remote-<transport>' <remote>
15 Remote helper programs are normally not used directly by end users,
16 but they are invoked by git when it needs to interact with remote
17 repositories git does not support natively. A given helper will
18 implement a subset of the capabilities documented here. When git
19 needs to interact with a repository using a remote helper, it spawns
20 the helper as an independent process, sends commands to the helper's
21 standard input, and expects results from the helper's standard
22 output. Because a remote helper runs as an independent process from
23 git, there is no need to re-link git to add a new helper, nor any
24 need to link the helper with the implementation of git.
26 Every helper must support the "capabilities" command, which git will
27 use to determine what other commands the helper will accept. Other
28 commands generally concern facilities like discovering and updating
29 remote refs, transporting objects between the object database and
30 the remote repository, and updating the local object store.
32 Helpers supporting the 'fetch' capability can discover refs from the
33 remote repository and transfer objects reachable from those refs to
34 the local object store. Helpers supporting the 'push' capability can
35 transfer local objects to the remote repository and update remote refs.
37 Git comes with a "curl" family of remote helpers, that handle various
38 transport protocols, such as 'git-remote-http', 'git-remote-https',
39 'git-remote-ftp' and 'git-remote-ftps'. They implement the capabilities
40 'fetch', 'option', and 'push'.
45 Commands are given by the caller on the helper's standard input, one per line.
48 Lists the capabilities of the helper, one per line, ending
49 with a blank line. Each capability may be preceded with '*'.
50 This marks them mandatory for git version using the remote
51 helper to understand (unknown mandatory capability is fatal
55 Lists the refs, one per line, in the format "<value> <name>
56 [<attr> ...]". The value may be a hex sha1 hash, "@<dest>" for
57 a symref, or "?" to indicate that the helper could not get the
58 value of the ref. A space-separated list of attributes follows
59 the name; unrecognized attributes are ignored. After the
60 complete list, outputs a blank line.
62 If 'push' is supported this may be called as 'list for-push'
63 to obtain the current refs prior to sending one or more 'push'
64 commands to the helper.
66 'option' <name> <value>::
67 Set the transport helper option <name> to <value>. Outputs a
68 single line containing one of 'ok' (option successfully set),
69 'unsupported' (option not recognized) or 'error <msg>'
70 (option <name> is supported but <value> is not correct
71 for it). Options should be set before other commands,
72 and may how those commands behave.
74 Supported if the helper has the "option" capability.
76 'fetch' <sha1> <name>::
77 Fetches the given object, writing the necessary objects
78 to the database. Fetch commands are sent in a batch, one
79 per line, and the batch is terminated with a blank line.
80 Outputs a single blank line when all fetch commands in the
81 same batch are complete. Only objects which were reported
82 in the ref list with a sha1 may be fetched this way.
84 Optionally may output a 'lock <file>' line indicating a file under
85 GIT_DIR/objects/pack which is keeping a pack until refs can be
88 Supported if the helper has the "fetch" capability.
91 Pushes the given <src> commit or branch locally to the
92 remote branch described by <dst>. A batch sequence of
93 one or more push commands is terminated with a blank line.
95 Zero or more protocol options may be entered after the last 'push'
96 command, before the batch's terminating blank line.
98 When the push is complete, outputs one or more 'ok <dst>' or
99 'error <dst> <why>?' lines to indicate success or failure of
100 each pushed ref. The status report output is terminated by
101 a blank line. The option field <why> may be quoted in a C
102 style string if it contains an LF.
104 Supported if the helper has the "push" capability.
107 Produces a fast-import stream which imports the current value
108 of the named ref. It may additionally import other refs as
109 needed to construct the history efficiently. The script writes
110 to a helper-specific private namespace. The value of the named
111 ref should be written to a location in this namespace derived
112 by applying the refspecs from the "refspec" capability to the
115 Supported if the helper has the "import" capability.
117 'connect' <service>::
118 Connects to given service. Standard input and standard output
119 of helper are connected to specified service (git prefix is
120 included in service name so e.g. fetching uses 'git-upload-pack'
121 as service) on remote side. Valid replies to this command are
122 empty line (connection established), 'fallback' (no smart
123 transport support, fall back to dumb transports) and just
124 exiting with error message printed (can't connect, don't
125 bother trying to fall back). After line feed terminating the
126 positive (empty) response, the output of service starts. After
127 the connection ends, the remote helper exits.
129 Supported if the helper has the "connect" capability.
131 If a fatal error occurs, the program writes the error message to
132 stderr and exits. The caller should expect that a suitable error
133 message has been printed if the child closes the connection without
134 completing a valid response for the current command.
136 Additional commands may be supported, as may be determined from
137 capabilities reported by the helper.
143 This helper supports the 'fetch' command.
146 This helper supports the option command.
149 This helper supports the 'push' command.
152 This helper supports the 'import' command.
155 When using the import command, expect the source ref to have
156 been written to the destination ref. The earliest applicable
157 refspec takes precedence. For example
158 "refs/heads/*:refs/svn/origin/branches/*" means that, after an
159 "import refs/heads/name", the script has written to
160 refs/svn/origin/branches/name. If this capability is used at
161 all, it must cover all refs reported by the list command; if
162 it is not used, it is effectively "*:*"
165 This helper supports the 'connect' command.
171 The caller wants to use the ref list to prepare push
172 commands. A helper might chose to acquire the ref list by
173 opening a different type of connection to the destination.
176 This ref is unchanged since the last import or fetch, although
177 the helper cannot necessarily determine what value that produced.
181 'option verbosity' <N>::
182 Change the level of messages displayed by the helper.
183 When N is 0 the end-user has asked the process to be
184 quiet, and the helper should produce only error output.
185 N of 1 is the default level of verbosity, higher values
186 of N correspond to the number of -v flags passed on the
189 'option progress' \{'true'|'false'\}::
190 Enable (or disable) progress messages displayed by the
191 transport helper during a command.
193 'option depth' <depth>::
194 Deepen the history of a shallow repository.
196 'option followtags' \{'true'|'false'\}::
197 If enabled the helper should automatically fetch annotated
198 tag objects if the object the tag points at was transferred
199 during the fetch command. If the tag is not fetched by
200 the helper a second fetch command will usually be sent to
201 ask for the tag specifically. Some helpers may be able to
202 use this option to avoid a second network connection.
204 'option dry-run' \{'true'|'false'\}:
205 If true, pretend the operation completed successfully,
206 but don't actually change any repository data. For most
207 helpers this only applies to the 'push', if supported.
209 'option servpath <c-style-quoted-path>'::
210 Set service path (--upload-pack, --receive-pack etc.) for
211 next connect. Remote helper MAY support this option. Remote
212 helper MUST NOT rely on this option being set before
213 connect request occurs.
217 Documentation by Daniel Barkalow and Ilari Liusvaara
221 Part of the linkgit:git[1] suite