6 git-remote-helpers - Helper programs to interact with remote repositories
11 'git remote-<transport>' <repository> [<URL>]
16 Remote helper programs are normally not used directly by end users,
17 but they are invoked by git when it needs to interact with remote
18 repositories git does not support natively. A given helper will
19 implement a subset of the capabilities documented here. When git
20 needs to interact with a repository using a remote helper, it spawns
21 the helper as an independent process, sends commands to the helper's
22 standard input, and expects results from the helper's standard
23 output. Because a remote helper runs as an independent process from
24 git, there is no need to re-link git to add a new helper, nor any
25 need to link the helper with the implementation of git.
27 Every helper must support the "capabilities" command, which git will
28 use to determine what other commands the helper will accept. Other
29 commands generally concern facilities like discovering and updating
30 remote refs, transporting objects between the object database and
31 the remote repository, and updating the local object store.
33 Helpers supporting the 'fetch' capability can discover refs from the
34 remote repository and transfer objects reachable from those refs to
35 the local object store. Helpers supporting the 'push' capability can
36 transfer local objects to the remote repository and update remote refs.
38 Git comes with a "curl" family of remote helpers, that handle various
39 transport protocols, such as 'git-remote-http', 'git-remote-https',
40 'git-remote-ftp' and 'git-remote-ftps'. They implement the capabilities
41 'fetch', 'option', and 'push'.
46 Remote helper programs are invoked with one or (optionally) two
47 arguments. The first argument specifies a remote repository as in git;
48 it is either the name of a configured remote or a URL. The second
49 argument specifies a URL; it is usually of the form
50 '<transport>://<address>', but any arbitrary string is possible.
52 When git encounters a URL of the form '<transport>://<address>', where
53 '<transport>' is a protocol that it cannot handle natively, it
54 automatically invokes 'git remote-<transport>' with the full URL as
55 the second argument. If such a URL is encountered directly on the
56 command line, the first argument is the same as the second, and if it
57 is encountered in a configured remote, the first argument is the name
60 A URL of the form '<transport>::<address>' explicitly instructs git to
61 invoke 'git remote-<transport>' with '<address>' as the second
62 argument. If such a URL is encountered directly on the command line,
63 the first argument is '<address>', and if it is encountered in a
64 configured remote, the first argument is the name of that remote.
66 Additionally, when a configured remote has 'remote.<name>.vcs' set to
67 '<transport>', git explicitly invokes 'git remote-<transport>' with
68 '<name>' as the first argument. If set, the second argument is
69 'remote.<name>.url'; otherwise, the second argument is omitted.
74 Commands are given by the caller on the helper's standard input, one per line.
77 Lists the capabilities of the helper, one per line, ending
78 with a blank line. Each capability may be preceded with '*',
79 which marks them mandatory for git version using the remote
80 helper to understand (unknown mandatory capability is fatal
84 Lists the refs, one per line, in the format "<value> <name>
85 [<attr> ...]". The value may be a hex sha1 hash, "@<dest>" for
86 a symref, or "?" to indicate that the helper could not get the
87 value of the ref. A space-separated list of attributes follows
88 the name; unrecognized attributes are ignored. The list ends
91 If 'push' is supported this may be called as 'list for-push'
92 to obtain the current refs prior to sending one or more 'push'
93 commands to the helper.
95 'option' <name> <value>::
96 Sets the transport helper option <name> to <value>. Outputs a
97 single line containing one of 'ok' (option successfully set),
98 'unsupported' (option not recognized) or 'error <msg>'
99 (option <name> is supported but <value> is not valid
100 for it). Options should be set before other commands,
101 and may influence the behavior of those commands.
103 Supported if the helper has the "option" capability.
105 'fetch' <sha1> <name>::
106 Fetches the given object, writing the necessary objects
107 to the database. Fetch commands are sent in a batch, one
108 per line, terminated with a blank line.
109 Outputs a single blank line when all fetch commands in the
110 same batch are complete. Only objects which were reported
111 in the ref list with a sha1 may be fetched this way.
113 Optionally may output a 'lock <file>' line indicating a file under
114 GIT_DIR/objects/pack which is keeping a pack until refs can be
117 Supported if the helper has the "fetch" capability.
119 'push' +<src>:<dst>::
120 Pushes the given local <src> commit or branch to the
121 remote branch described by <dst>. A batch sequence of
122 one or more push commands is terminated with a blank line.
124 Zero or more protocol options may be entered after the last 'push'
125 command, before the batch's terminating blank line.
127 When the push is complete, outputs one or more 'ok <dst>' or
128 'error <dst> <why>?' lines to indicate success or failure of
129 each pushed ref. The status report output is terminated by
130 a blank line. The option field <why> may be quoted in a C
131 style string if it contains an LF.
133 Supported if the helper has the "push" capability.
136 Produces a fast-import stream which imports the current value
137 of the named ref. It may additionally import other refs as
138 needed to construct the history efficiently. The script writes
139 to a helper-specific private namespace. The value of the named
140 ref should be written to a location in this namespace derived
141 by applying the refspecs from the "refspec" capability to the
144 Especially useful for interoperability with a foreign versioning
147 Supported if the helper has the "import" capability.
149 'connect' <service>::
150 Connects to given service. Standard input and standard output
151 of helper are connected to specified service (git prefix is
152 included in service name so e.g. fetching uses 'git-upload-pack'
153 as service) on remote side. Valid replies to this command are
154 empty line (connection established), 'fallback' (no smart
155 transport support, fall back to dumb transports) and just
156 exiting with error message printed (can't connect, don't
157 bother trying to fall back). After line feed terminating the
158 positive (empty) response, the output of service starts. After
159 the connection ends, the remote helper exits.
161 Supported if the helper has the "connect" capability.
163 If a fatal error occurs, the program writes the error message to
164 stderr and exits. The caller should expect that a suitable error
165 message has been printed if the child closes the connection without
166 completing a valid response for the current command.
168 Additional commands may be supported, as may be determined from
169 capabilities reported by the helper.
179 This helper supports the corresponding command with the same name.
182 When using the import command, expect the source ref to have
183 been written to the destination ref. The earliest applicable
184 refspec takes precedence. For example
185 "refs/heads/{asterisk}:refs/svn/origin/branches/{asterisk}" means
186 that, after an "import refs/heads/name", the script has written to
187 refs/svn/origin/branches/name. If this capability is used at
188 all, it must cover all refs reported by the list command; if
189 it is not used, it is effectively "{asterisk}:{asterisk}"
195 The caller wants to use the ref list to prepare push
196 commands. A helper might chose to acquire the ref list by
197 opening a different type of connection to the destination.
200 This ref is unchanged since the last import or fetch, although
201 the helper cannot necessarily determine what value that produced.
205 'option verbosity' <n>::
206 Changes the verbosity of messages displayed by the helper.
207 A value of 0 for <n> means that processes operate
208 quietly, and the helper produces only error output.
209 1 is the default level of verbosity, and higher values
210 of <n> correspond to the number of -v flags passed on the
213 'option progress' \{'true'|'false'\}::
214 Enables (or disables) progress messages displayed by the
215 transport helper during a command.
217 'option depth' <depth>::
218 Deepens the history of a shallow repository.
220 'option followtags' \{'true'|'false'\}::
221 If enabled the helper should automatically fetch annotated
222 tag objects if the object the tag points at was transferred
223 during the fetch command. If the tag is not fetched by
224 the helper a second fetch command will usually be sent to
225 ask for the tag specifically. Some helpers may be able to
226 use this option to avoid a second network connection.
228 'option dry-run' \{'true'|'false'\}:
229 If true, pretend the operation completed successfully,
230 but don't actually change any repository data. For most
231 helpers this only applies to the 'push', if supported.
233 'option servpath <c-style-quoted-path>'::
234 Sets service path (--upload-pack, --receive-pack etc.) for
235 next connect. Remote helper may support this option, but
236 must not rely on this option being set before
237 connect request occurs.
241 linkgit:git-remote[1]
245 Part of the linkgit:git[1] suite