Documentation / git-remote-helpers.txton commit Merge branch 'sr/transport-helper-fix' (59d9ba8)
   1git-remote-helpers(1)
   2=====================
   3
   4NAME
   5----
   6git-remote-helpers - Helper programs to interact with remote repositories
   7
   8SYNOPSIS
   9--------
  10[verse]
  11'git remote-<transport>' <repository> [<URL>]
  12
  13DESCRIPTION
  14-----------
  15
  16Remote 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.
  51The 'GIT_DIR' environment variable is set up for the remote helper
  52and can be used to determine where to store additional data or from
  53which directory to invoke auxiliary git commands.
  54
  55When git encounters a URL of the form '<transport>://<address>', where
  56'<transport>' is a protocol that it cannot handle natively, it
  57automatically invokes 'git remote-<transport>' with the full URL as
  58the second argument. If such a URL is encountered directly on the
  59command line, the first argument is the same as the second, and if it
  60is encountered in a configured remote, the first argument is the name
  61of that remote.
  62
  63A URL of the form '<transport>::<address>' explicitly instructs git to
  64invoke 'git remote-<transport>' with '<address>' as the second
  65argument. If such a URL is encountered directly on the command line,
  66the first argument is '<address>', and if it is encountered in a
  67configured remote, the first argument is the name of that remote.
  68
  69Additionally, when a configured remote has 'remote.<name>.vcs' set to
  70'<transport>', git explicitly invokes 'git remote-<transport>' with
  71'<name>' as the first argument. If set, the second argument is
  72'remote.<name>.url'; otherwise, the second argument is omitted.
  73
  74COMMANDS
  75--------
  76
  77Commands are given by the caller on the helper's standard input, one per line.
  78
  79'capabilities'::
  80        Lists the capabilities of the helper, one per line, ending
  81        with a blank line. Each capability may be preceded with '*',
  82        which marks them mandatory for git version using the remote
  83        helper to understand (unknown mandatory capability is fatal
  84        error).
  85
  86'list'::
  87        Lists the refs, one per line, in the format "<value> <name>
  88        [<attr> ...]". The value may be a hex sha1 hash, "@<dest>" for
  89        a symref, or "?" to indicate that the helper could not get the
  90        value of the ref. A space-separated list of attributes follows
  91        the name; unrecognized attributes are ignored. The list ends
  92        with a blank line.
  93+
  94If 'push' is supported this may be called as 'list for-push'
  95to obtain the current refs prior to sending one or more 'push'
  96commands to the helper.
  97
  98'option' <name> <value>::
  99        Sets the transport helper option <name> to <value>.  Outputs a
 100        single line containing one of 'ok' (option successfully set),
 101        'unsupported' (option not recognized) or 'error <msg>'
 102        (option <name> is supported but <value> is not valid
 103        for it).  Options should be set before other commands,
 104        and may influence the behavior of those commands.
 105+
 106Supported if the helper has the "option" capability.
 107
 108'fetch' <sha1> <name>::
 109        Fetches the given object, writing the necessary objects
 110        to the database.  Fetch commands are sent in a batch, one
 111        per line, terminated with a blank line.
 112        Outputs a single blank line when all fetch commands in the
 113        same batch are complete. Only objects which were reported
 114        in the ref list with a sha1 may be fetched this way.
 115+
 116Optionally may output a 'lock <file>' line indicating a file under
 117GIT_DIR/objects/pack which is keeping a pack until refs can be
 118suitably updated.
 119+
 120Supported if the helper has the "fetch" capability.
 121
 122'push' +<src>:<dst>::
 123        Pushes the given local <src> commit or branch to the
 124        remote branch described by <dst>.  A batch sequence of
 125        one or more push commands is terminated with a blank line.
 126+
 127Zero or more protocol options may be entered after the last 'push'
 128command, before the batch's terminating blank line.
 129+
 130When the push is complete, outputs one or more 'ok <dst>' or
 131'error <dst> <why>?' lines to indicate success or failure of
 132each pushed ref.  The status report output is terminated by
 133a blank line.  The option field <why> may be quoted in a C
 134style string if it contains an LF.
 135+
 136Supported if the helper has the "push" capability.
 137
 138'import' <name>::
 139        Produces a fast-import stream which imports the current value
 140        of the named ref. It may additionally import other refs as
 141        needed to construct the history efficiently. The script writes
 142        to a helper-specific private namespace. The value of the named
 143        ref should be written to a location in this namespace derived
 144        by applying the refspecs from the "refspec" capability to the
 145        name of the ref.
 146+
 147Especially useful for interoperability with a foreign versioning
 148system.
 149+
 150Supported if the helper has the "import" capability.
 151
 152'connect' <service>::
 153        Connects to given service. Standard input and standard output
 154        of helper are connected to specified service (git prefix is
 155        included in service name so e.g. fetching uses 'git-upload-pack'
 156        as service) on remote side. Valid replies to this command are
 157        empty line (connection established), 'fallback' (no smart
 158        transport support, fall back to dumb transports) and just
 159        exiting with error message printed (can't connect, don't
 160        bother trying to fall back). After line feed terminating the
 161        positive (empty) response, the output of service starts. After
 162        the connection ends, the remote helper exits.
 163+
 164Supported if the helper has the "connect" capability.
 165
 166If a fatal error occurs, the program writes the error message to
 167stderr and exits. The caller should expect that a suitable error
 168message has been printed if the child closes the connection without
 169completing a valid response for the current command.
 170
 171Additional commands may be supported, as may be determined from
 172capabilities reported by the helper.
 173
 174CAPABILITIES
 175------------
 176
 177'fetch'::
 178'option'::
 179'push'::
 180'import'::
 181'connect'::
 182        This helper supports the corresponding command with the same name.
 183
 184'refspec' 'spec'::
 185        When using the import command, expect the source ref to have
 186        been written to the destination ref. The earliest applicable
 187        refspec takes precedence. For example
 188        "refs/heads/{asterisk}:refs/svn/origin/branches/{asterisk}" means
 189        that, after an "import refs/heads/name", the script has written to
 190        refs/svn/origin/branches/name. If this capability is used at
 191        all, it must cover all refs reported by the list command; if
 192        it is not used, it is effectively "{asterisk}:{asterisk}"
 193
 194REF LIST ATTRIBUTES
 195-------------------
 196
 197'for-push'::
 198        The caller wants to use the ref list to prepare push
 199        commands.  A helper might chose to acquire the ref list by
 200        opening a different type of connection to the destination.
 201
 202'unchanged'::
 203        This ref is unchanged since the last import or fetch, although
 204        the helper cannot necessarily determine what value that produced.
 205
 206OPTIONS
 207-------
 208'option verbosity' <n>::
 209        Changes the verbosity of messages displayed by the helper.
 210        A value of 0 for <n> means that processes operate
 211        quietly, and the helper produces only error output.
 212        1 is the default level of verbosity, and higher values
 213        of <n> correspond to the number of -v flags passed on the
 214        command line.
 215
 216'option progress' \{'true'|'false'\}::
 217        Enables (or disables) progress messages displayed by the
 218        transport helper during a command.
 219
 220'option depth' <depth>::
 221        Deepens the history of a shallow repository.
 222
 223'option followtags' \{'true'|'false'\}::
 224        If enabled the helper should automatically fetch annotated
 225        tag objects if the object the tag points at was transferred
 226        during the fetch command.  If the tag is not fetched by
 227        the helper a second fetch command will usually be sent to
 228        ask for the tag specifically.  Some helpers may be able to
 229        use this option to avoid a second network connection.
 230
 231'option dry-run' \{'true'|'false'\}:
 232        If true, pretend the operation completed successfully,
 233        but don't actually change any repository data.  For most
 234        helpers this only applies to the 'push', if supported.
 235
 236'option servpath <c-style-quoted-path>'::
 237        Sets service path (--upload-pack, --receive-pack etc.) for
 238        next connect. Remote helper may support this option, but
 239        must not rely on this option being set before
 240        connect request occurs.
 241
 242SEE ALSO
 243--------
 244linkgit:git-remote[1]
 245
 246GIT
 247---
 248Part of the linkgit:git[1] suite