1GIT-REMOTE-HELPERS(1)             Git Manual             GIT-REMOTE-HELPERS(1)
2
3
4

NAME

6       git-remote-helpers - Helper programs to interact with remote
7       repositories
8

SYNOPSIS

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

DESCRIPTION

13       Remote helper programs are normally not used directly by end users, but
14       they are invoked by git when it needs to interact with remote
15       repositories git does not support natively. A given helper will
16       implement a subset of the capabilities documented here. When git needs
17       to interact with a repository using a remote helper, it spawns the
18       helper as an independent process, sends commands to the helper’s
19       standard input, and expects results from the helper’s standard output.
20       Because a remote helper runs as an independent process from git, there
21       is no need to re-link git to add a new helper, nor any need to link the
22       helper with the implementation of git.
23
24       Every helper must support the "capabilities" command, which git will
25       use to determine what other commands the helper will accept. Other
26       commands generally concern facilities like discovering and updating
27       remote refs, transporting objects between the object database and the
28       remote repository, and updating the local object store.
29
30       Helpers supporting the fetch capability can discover refs from the
31       remote repository and transfer objects reachable from those refs to the
32       local object store. Helpers supporting the push capability can transfer
33       local objects to the remote repository and update remote refs.
34
35       Git comes with a "curl" family of remote helpers, that handle various
36       transport protocols, such as git-remote-http, git-remote-https,
37       git-remote-ftp and git-remote-ftps. They implement the capabilities
38       fetch, option, and push.
39

INVOCATION

41       Remote helper programs are invoked with one or (optionally) two
42       arguments. The first argument specifies a remote repository as in git;
43       it is either the name of a configured remote or a URL. The second
44       argument specifies a URL; it is usually of the form
45       <transport>://<address>, but any arbitrary string is possible.
46
47       When git encounters a URL of the form <transport>://<address>, where
48       <transport> is a protocol that it cannot handle natively, it
49       automatically invokes git remote-<transport> with the full URL as the
50       second argument. If such a URL is encountered directly on the command
51       line, the first argument is the same as the second, and if it is
52       encountered in a configured remote, the first argument is the name of
53       that remote.
54
55       A URL of the form <transport>::<address> explicitly instructs git to
56       invoke git remote-<transport> with <address> as the second argument. If
57       such a URL is encountered directly on the command line, the first
58       argument is <address>, and if it is encountered in a configured remote,
59       the first argument is the name of that remote.
60
61       Additionally, when a configured remote has remote.<name>.vcs set to
62       <transport>, git explicitly invokes git remote-<transport> with <name>
63       as the first argument. If set, the second argument is
64       remote.<name>.url; otherwise, the second argument is omitted.
65

COMMANDS

67       Commands are given by the caller on the helper’s standard input, one
68       per line.
69
70       capabilities
71           Lists the capabilities of the helper, one per line, ending with a
72           blank line. Each capability may be preceded with *, which marks
73           them mandatory for git version using the remote helper to
74           understand (unknown mandatory capability is fatal error).
75
76       list
77           Lists the refs, one per line, in the format "<value> <name> [<attr>
78           ...]". The value may be a hex sha1 hash, "@<dest>" for a symref, or
79           "?" to indicate that the helper could not get the value of the ref.
80           A space-separated list of attributes follows the name; unrecognized
81           attributes are ignored. The list ends with a blank line.
82
83           If push is supported this may be called as list for-push to obtain
84           the current refs prior to sending one or more push commands to the
85           helper.
86
87       option <name> <value>
88           Sets the transport helper option <name> to <value>. Outputs a
89           single line containing one of ok (option successfully set),
90           unsupported (option not recognized) or error <msg> (option <name>
91           is supported but <value> is not valid for it). Options should be
92           set before other commands, and may influence the behavior of those
93           commands.
94
95           Supported if the helper has the "option" capability.
96
97       fetch <sha1> <name>
98           Fetches the given object, writing the necessary objects to the
99           database. Fetch commands are sent in a batch, one per line,
100           terminated with a blank line. Outputs a single blank line when all
101           fetch commands in the same batch are complete. Only objects which
102           were reported in the ref list with a sha1 may be fetched this way.
103
104           Optionally may output a lock <file> line indicating a file under
105           GIT_DIR/objects/pack which is keeping a pack until refs can be
106           suitably updated.
107
108           Supported if the helper has the "fetch" capability.
109
110       push +<src>:<dst>
111           Pushes the given local <src> commit or branch to the remote branch
112           described by <dst>. A batch sequence of one or more push commands
113           is terminated with a blank line.
114
115           Zero or more protocol options may be entered after the last push
116           command, before the batch’s terminating blank line.
117
118           When the push is complete, outputs one or more ok <dst> or error
119           <dst> <why>?  lines to indicate success or failure of each pushed
120           ref. The status report output is terminated by a blank line. The
121           option field <why> may be quoted in a C style string if it contains
122           an LF.
123
124           Supported if the helper has the "push" capability.
125
126       import <name>
127           Produces a fast-import stream which imports the current value of
128           the named ref. It may additionally import other refs as needed to
129           construct the history efficiently. The script writes to a
130           helper-specific private namespace. The value of the named ref
131           should be written to a location in this namespace derived by
132           applying the refspecs from the "refspec" capability to the name of
133           the ref.
134
135           Especially useful for interoperability with a foreign versioning
136           system.
137
138           Supported if the helper has the "import" capability.
139
140       connect <service>
141           Connects to given service. Standard input and standard output of
142           helper are connected to specified service (git prefix is included
143           in service name so e.g. fetching uses git-upload-pack as service)
144           on remote side. Valid replies to this command are empty line
145           (connection established), fallback (no smart transport support,
146           fall back to dumb transports) and just exiting with error message
147           printed (can’t connect, don’t bother trying to fall back). After
148           line feed terminating the positive (empty) response, the output of
149           service starts. After the connection ends, the remote helper exits.
150
151           Supported if the helper has the "connect" capability.
152
153       If a fatal error occurs, the program writes the error message to stderr
154       and exits. The caller should expect that a suitable error message has
155       been printed if the child closes the connection without completing a
156       valid response for the current command.
157
158       Additional commands may be supported, as may be determined from
159       capabilities reported by the helper.
160

CAPABILITIES

162       fetch, option, push, import, connect
163           This helper supports the corresponding command with the same name.
164
165       refspec spec
166           When using the import command, expect the source ref to have been
167           written to the destination ref. The earliest applicable refspec
168           takes precedence. For example
169           "refs/heads/:refs/svn/origin/branches/" means that, after an
170           "import refs/heads/name", the script has written to
171           refs/svn/origin/branches/name. If this capability is used at all,
172           it must cover all refs reported by the list command; if it is not
173           used, it is effectively ":"
174

REF LIST ATTRIBUTES

176       for-push
177           The caller wants to use the ref list to prepare push commands. A
178           helper might chose to acquire the ref list by opening a different
179           type of connection to the destination.
180
181       unchanged
182           This ref is unchanged since the last import or fetch, although the
183           helper cannot necessarily determine what value that produced.
184

OPTIONS

186       option verbosity <n>
187           Changes the verbosity of messages displayed by the helper. A value
188           of 0 for <n> means that processes operate quietly, and the helper
189           produces only error output. 1 is the default level of verbosity,
190           and higher values of <n> correspond to the number of -v flags
191           passed on the command line.
192
193       option progress {true|false}
194           Enables (or disables) progress messages displayed by the transport
195           helper during a command.
196
197       option depth <depth>
198           Deepens the history of a shallow repository.
199
200       option followtags {true|false}
201           If enabled the helper should automatically fetch annotated tag
202           objects if the object the tag points at was transferred during the
203           fetch command. If the tag is not fetched by the helper a second
204           fetch command will usually be sent to ask for the tag specifically.
205           Some helpers may be able to use this option to avoid a second
206           network connection.
207
208       option dry-run {true|false}: If true, pretend the operation completed
209       successfully, but don’t actually change any repository data. For most
210       helpers this only applies to the push, if supported.
211
212       option servpath <c-style-quoted-path>
213           Sets service path (--upload-pack, --receive-pack etc.) for next
214           connect. Remote helper may support this option, but must not rely
215           on this option being set before connect request occurs.
216

SEE ALSO

218       git-remote(1)
219

DOCUMENTATION

221       Documentation by Daniel Barkalow and Ilari Liusvaara
222

GIT

224       Part of the git(1) suite
225
226
227
228Git 1.7.4.4                       04/11/2011             GIT-REMOTE-HELPERS(1)
Impressum