blob: 930b4034ac5dc60481afe34f9cd82fd756639190 [file] [log] [blame]
Junio C Hamano7df6dcf2009-09-13 09:51:171git-remote-helpers(1)
2=====================
3
4NAME
5----
Junio C Hamano0c053e82010-04-19 06:46:346git-remote-helpers - Helper programs to interact with remote repositories
Junio C Hamano7df6dcf2009-09-13 09:51:177
8SYNOPSIS
9--------
Junio C Hamano15567bc2011-07-23 00:51:5910[verse]
Junio C Hamano0c053e82010-04-19 06:46:3411'git remote-<transport>' <repository> [<URL>]
Junio C Hamano7df6dcf2009-09-13 09:51:1712
13DESCRIPTION
14-----------
15
Junio C Hamano0c053e82010-04-19 06:46:3416Remote helper programs are normally not used directly by end users,
17but they are invoked by git when it needs to interact with remote
18repositories git does not support natively. A given helper will
19implement a subset of the capabilities documented here. When git
20needs to interact with a repository using a remote helper, it spawns
21the helper as an independent process, sends commands to the helper's
22standard input, and expects results from the helper's standard
23output. Because a remote helper runs as an independent process from
24git, there is no need to re-link git to add a new helper, nor any
25need to link the helper with the implementation of git.
26
27Every helper must support the "capabilities" command, which git will
28use to determine what other commands the helper will accept. Other
29commands generally concern facilities like discovering and updating
30remote refs, transporting objects between the object database and
31the remote repository, and updating the local object store.
32
33Helpers supporting the 'fetch' capability can discover refs from the
34remote repository and transfer objects reachable from those refs to
35the local object store. Helpers supporting the 'push' capability can
36transfer local objects to the remote repository and update remote refs.
37
38Git comes with a "curl" family of remote helpers, that handle various
39transport 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'.
42
43INVOCATION
44----------
45
46Remote helper programs are invoked with one or (optionally) two
47arguments. The first argument specifies a remote repository as in git;
48it is either the name of a configured remote or a URL. The second
49argument specifies a URL; it is usually of the form
50'<transport>://<address>', but any arbitrary string is possible.
51
52When git encounters a URL of the form '<transport>://<address>', where
53'<transport>' is a protocol that it cannot handle natively, it
54automatically invokes 'git remote-<transport>' with the full URL as
55the second argument. If such a URL is encountered directly on the
56command line, the first argument is the same as the second, and if it
57is encountered in a configured remote, the first argument is the name
58of that remote.
59
60A URL of the form '<transport>::<address>' explicitly instructs git to
61invoke 'git remote-<transport>' with '<address>' as the second
62argument. If such a URL is encountered directly on the command line,
63the first argument is '<address>', and if it is encountered in a
64configured remote, the first argument is the name of that remote.
65
66Additionally, 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.
Junio C Hamano7df6dcf2009-09-13 09:51:1770
71COMMANDS
72--------
73
74Commands are given by the caller on the helper's standard input, one per line.
75
76'capabilities'::
77Lists the capabilities of the helper, one per line, ending
Junio C Hamano0c053e82010-04-19 06:46:3478with a blank line. Each capability may be preceded with '*',
79which marks them mandatory for git version using the remote
Junio C Hamano3c8d6702010-01-13 23:09:0380helper to understand (unknown mandatory capability is fatal
81error).
Junio C Hamano7df6dcf2009-09-13 09:51:1782
83'list'::
84Lists the refs, one per line, in the format "<value> <name>
85[<attr> ...]". The value may be a hex sha1 hash, "@<dest>" for
86a symref, or "?" to indicate that the helper could not get the
87value of the ref. A space-separated list of attributes follows
Junio C Hamano0c053e82010-04-19 06:46:3488the name; unrecognized attributes are ignored. The list ends
89with a blank line.
Junio C Hamano3b70d3c2009-11-21 17:37:3790+
91If 'push' is supported this may be called as 'list for-push'
92to obtain the current refs prior to sending one or more 'push'
93commands to the helper.
94
95'option' <name> <value>::
Junio C Hamano0c053e82010-04-19 06:46:3496Sets the transport helper option <name> to <value>. Outputs a
Junio C Hamano3b70d3c2009-11-21 17:37:3797single line containing one of 'ok' (option successfully set),
98'unsupported' (option not recognized) or 'error <msg>'
Junio C Hamano0c053e82010-04-19 06:46:3499(option <name> is supported but <value> is not valid
Junio C Hamano3b70d3c2009-11-21 17:37:37100for it). Options should be set before other commands,
Junio C Hamano0c053e82010-04-19 06:46:34101and may influence the behavior of those commands.
Junio C Hamano3b70d3c2009-11-21 17:37:37102+
103Supported if the helper has the "option" capability.
Junio C Hamano7df6dcf2009-09-13 09:51:17104
105'fetch' <sha1> <name>::
Junio C Hamano3b70d3c2009-11-21 17:37:37106Fetches the given object, writing the necessary objects
107to the database. Fetch commands are sent in a batch, one
Junio C Hamano0c053e82010-04-19 06:46:34108per line, terminated with a blank line.
Junio C Hamano3b70d3c2009-11-21 17:37:37109Outputs a single blank line when all fetch commands in the
110same batch are complete. Only objects which were reported
111in the ref list with a sha1 may be fetched this way.
112+
113Optionally may output a 'lock <file>' line indicating a file under
114GIT_DIR/objects/pack which is keeping a pack until refs can be
115suitably updated.
Junio C Hamano7df6dcf2009-09-13 09:51:17116+
117Supported if the helper has the "fetch" capability.
118
Junio C Hamano3b70d3c2009-11-21 17:37:37119'push' +<src>:<dst>::
Junio C Hamano0c053e82010-04-19 06:46:34120Pushes the given local <src> commit or branch to the
Junio C Hamano3b70d3c2009-11-21 17:37:37121remote branch described by <dst>. A batch sequence of
122one or more push commands is terminated with a blank line.
123+
124Zero or more protocol options may be entered after the last 'push'
125command, before the batch's terminating blank line.
126+
127When the push is complete, outputs one or more 'ok <dst>' or
128'error <dst> <why>?' lines to indicate success or failure of
129each pushed ref. The status report output is terminated by
130a blank line. The option field <why> may be quoted in a C
131style string if it contains an LF.
132+
133Supported if the helper has the "push" capability.
134
Junio C Hamano096dde22009-12-26 23:14:11135'import' <name>::
136Produces a fast-import stream which imports the current value
137of the named ref. It may additionally import other refs as
138needed to construct the history efficiently. The script writes
139to a helper-specific private namespace. The value of the named
140ref should be written to a location in this namespace derived
141by applying the refspecs from the "refspec" capability to the
142name of the ref.
143+
Junio C Hamano0c053e82010-04-19 06:46:34144Especially useful for interoperability with a foreign versioning
145system.
146+
Junio C Hamano096dde22009-12-26 23:14:11147Supported if the helper has the "import" capability.
148
Junio C Hamano3c8d6702010-01-13 23:09:03149'connect' <service>::
150Connects to given service. Standard input and standard output
151of helper are connected to specified service (git prefix is
152included in service name so e.g. fetching uses 'git-upload-pack'
153as service) on remote side. Valid replies to this command are
154empty line (connection established), 'fallback' (no smart
155transport support, fall back to dumb transports) and just
156exiting with error message printed (can't connect, don't
157bother trying to fall back). After line feed terminating the
158positive (empty) response, the output of service starts. After
159the connection ends, the remote helper exits.
160+
161Supported if the helper has the "connect" capability.
162
Junio C Hamano7df6dcf2009-09-13 09:51:17163If a fatal error occurs, the program writes the error message to
164stderr and exits. The caller should expect that a suitable error
165message has been printed if the child closes the connection without
166completing a valid response for the current command.
167
168Additional commands may be supported, as may be determined from
169capabilities reported by the helper.
170
171CAPABILITIES
172------------
173
174'fetch'::
Junio C Hamano3b70d3c2009-11-21 17:37:37175'option'::
Junio C Hamano3b70d3c2009-11-21 17:37:37176'push'::
Junio C Hamano096dde22009-12-26 23:14:11177'import'::
Junio C Hamano0c053e82010-04-19 06:46:34178'connect'::
179This helper supports the corresponding command with the same name.
Junio C Hamano096dde22009-12-26 23:14:11180
181'refspec' 'spec'::
182When using the import command, expect the source ref to have
183been written to the destination ref. The earliest applicable
184refspec takes precedence. For example
Junio C Hamanoef5a2f92011-05-31 19:53:33185"refs/heads/{asterisk}:refs/svn/origin/branches/{asterisk}" means
186that, after an "import refs/heads/name", the script has written to
Junio C Hamano096dde22009-12-26 23:14:11187refs/svn/origin/branches/name. If this capability is used at
188all, it must cover all refs reported by the list command; if
Junio C Hamanoef5a2f92011-05-31 19:53:33189it is not used, it is effectively "{asterisk}:{asterisk}"
Junio C Hamano096dde22009-12-26 23:14:11190
Junio C Hamano7df6dcf2009-09-13 09:51:17191REF LIST ATTRIBUTES
192-------------------
193
Junio C Hamano3b70d3c2009-11-21 17:37:37194'for-push'::
195The caller wants to use the ref list to prepare push
196commands. A helper might chose to acquire the ref list by
197opening a different type of connection to the destination.
198
Junio C Hamano096dde22009-12-26 23:14:11199'unchanged'::
200This ref is unchanged since the last import or fetch, although
201the helper cannot necessarily determine what value that produced.
202
Junio C Hamano3b70d3c2009-11-21 17:37:37203OPTIONS
204-------
Junio C Hamano63c2bc92011-02-28 06:41:28205'option verbosity' <n>::
Junio C Hamano0c053e82010-04-19 06:46:34206Changes the verbosity of messages displayed by the helper.
Junio C Hamano63c2bc92011-02-28 06:41:28207A value of 0 for <n> means that processes operate
Junio C Hamano0c053e82010-04-19 06:46:34208quietly, and the helper produces only error output.
2091 is the default level of verbosity, and higher values
Junio C Hamano63c2bc92011-02-28 06:41:28210of <n> correspond to the number of -v flags passed on the
Junio C Hamano3b70d3c2009-11-21 17:37:37211command line.
212
213'option progress' \{'true'|'false'\}::
Junio C Hamano0c053e82010-04-19 06:46:34214Enables (or disables) progress messages displayed by the
Junio C Hamano3b70d3c2009-11-21 17:37:37215transport helper during a command.
216
217'option depth' <depth>::
Junio C Hamano0c053e82010-04-19 06:46:34218Deepens the history of a shallow repository.
Junio C Hamano3b70d3c2009-11-21 17:37:37219
220'option followtags' \{'true'|'false'\}::
221If enabled the helper should automatically fetch annotated
222tag objects if the object the tag points at was transferred
223during the fetch command. If the tag is not fetched by
224the helper a second fetch command will usually be sent to
225ask for the tag specifically. Some helpers may be able to
226use this option to avoid a second network connection.
227
228'option dry-run' \{'true'|'false'\}:
229If true, pretend the operation completed successfully,
230but don't actually change any repository data. For most
231helpers this only applies to the 'push', if supported.
Junio C Hamano7df6dcf2009-09-13 09:51:17232
Junio C Hamano3c8d6702010-01-13 23:09:03233'option servpath <c-style-quoted-path>'::
Junio C Hamano0c053e82010-04-19 06:46:34234Sets service path (--upload-pack, --receive-pack etc.) for
235next connect. Remote helper may support this option, but
236must not rely on this option being set before
Junio C Hamano3c8d6702010-01-13 23:09:03237connect request occurs.
238
Junio C Hamano0c053e82010-04-19 06:46:34239SEE ALSO
240--------
241linkgit:git-remote[1]
242
Junio C Hamano7df6dcf2009-09-13 09:51:17243GIT
244---
245Part of the linkgit:git[1] suite