Documentation / urls.txton commit Merge branch 'mg/mailmap-update' (59d1e01)
   1GIT URLS[[URLS]]
   2----------------
   3
   4One of the following notations can be used
   5to name the remote repository:
   6
   7- rsync://host.xz/path/to/repo.git/
   8- http://host.xz{startsb}:port{endsb}/path/to/repo.git/
   9- https://host.xz{startsb}:port{endsb}/path/to/repo.git/
  10- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
  11- git://host.xz{startsb}:port{endsb}/~user/path/to/repo.git/
  12- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
  13- ssh://{startsb}user@{endsb}host.xz/path/to/repo.git/
  14- ssh://{startsb}user@{endsb}host.xz/~user/path/to/repo.git/
  15- ssh://{startsb}user@{endsb}host.xz/~/path/to/repo.git
  16
  17SSH is the default transport protocol over the network.  You can
  18optionally specify which user to log-in as, and an alternate,
  19scp-like syntax is also supported.  Both syntaxes support
  20username expansion, as does the native git protocol, but
  21only the former supports port specification. The following
  22three are identical to the last three above, respectively:
  23
  24- {startsb}user@{endsb}host.xz:/path/to/repo.git/
  25- {startsb}user@{endsb}host.xz:~user/path/to/repo.git/
  26- {startsb}user@{endsb}host.xz:path/to/repo.git
  27
  28To sync with a local directory, you can use:
  29
  30- /path/to/repo.git/
  31- file:///path/to/repo.git/
  32
  33ifndef::git-clone[]
  34They are mostly equivalent, except when cloning.  See
  35linkgit:git-clone[1] for details.
  36endif::git-clone[]
  37
  38ifdef::git-clone[]
  39They are equivalent, except the former implies --local option.
  40endif::git-clone[]
  41
  42
  43If there are a large number of similarly-named remote repositories and
  44you want to use a different format for them (such that the URLs you
  45use will be rewritten into URLs that work), you can create a
  46configuration section of the form:
  47
  48------------
  49        [url "<actual url base>"]
  50                insteadOf = <other url base>
  51------------
  52
  53For example, with this:
  54
  55------------
  56        [url "git://git.host.xz/"]
  57                insteadOf = host.xz:/path/to/
  58                insteadOf = work:
  59------------
  60
  61a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
  62rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".
  63
  64If you want to rewrite URLs for push only, you can create a
  65configuration section of the form:
  66
  67------------
  68        [url "<actual url base>"]
  69                pushInsteadOf = <other url base>
  70------------
  71
  72For example, with this:
  73
  74------------
  75        [url "ssh://example.org/"]
  76                pushInsteadOf = git://example.org/
  77------------
  78
  79a URL like "git://example.org/path/to/repo.git" will be rewritten to
  80"ssh://example.org/path/to/repo.git" for pushes, but pulls will still
  81use the original URL.