Documentation / urls.txton commit Merge tag 'gitgui-0.18.0' of git://repo.or.cz/git-gui (fb7dfaa)
   1GIT URLS[[URLS]]
   2----------------
   3
   4In general, URLs contain information about the transport protocol, the
   5address of the remote server, and the path to the repository.
   6Depending on the transport protocol, some of this information may be
   7absent.
   8
   9Git supports ssh, git, http, and https protocols (in addition, ftp,
  10and ftps can be used for fetching and rsync can be used for fetching
  11and pushing, but these are inefficient and deprecated; do not use
  12them).
  13
  14The following syntaxes may be used with them:
  15
  16- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
  17- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
  18- http{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
  19- ftp{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
  20- rsync://host.xz/path/to/repo.git/
  21
  22An alternative scp-like syntax may also be used with the ssh protocol:
  23
  24- {startsb}user@{endsb}host.xz:path/to/repo.git/
  25
  26This syntax is only recognized if there are no slashes before the
  27first colon. This helps differentiate a local path that contains a
  28colon. For example the local path `foo:bar` could be specified as an
  29absolute path or `./foo:bar` to avoid being misinterpreted as an ssh
  30url.
  31
  32The ssh and git protocols additionally support ~username expansion:
  33
  34- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
  35- git://host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
  36- {startsb}user@{endsb}host.xz:/~{startsb}user{endsb}/path/to/repo.git/
  37
  38For local repositories, also supported by Git natively, the following
  39syntaxes may be used:
  40
  41- /path/to/repo.git/
  42- \file:///path/to/repo.git/
  43
  44ifndef::git-clone[]
  45These two syntaxes are mostly equivalent, except when cloning, when
  46the former implies --local option. See linkgit:git-clone[1] for
  47details.
  48endif::git-clone[]
  49
  50ifdef::git-clone[]
  51These two syntaxes are mostly equivalent, except the former implies
  52--local option.
  53endif::git-clone[]
  54
  55When Git doesn't know how to handle a certain transport protocol, it
  56attempts to use the 'remote-<transport>' remote helper, if one
  57exists. To explicitly request a remote helper, the following syntax
  58may be used:
  59
  60- <transport>::<address>
  61
  62where <address> may be a path, a server and path, or an arbitrary
  63URL-like string recognized by the specific remote helper being
  64invoked. See linkgit:gitremote-helpers[1] for details.
  65
  66If there are a large number of similarly-named remote repositories and
  67you want to use a different format for them (such that the URLs you
  68use will be rewritten into URLs that work), you can create a
  69configuration section of the form:
  70
  71------------
  72        [url "<actual url base>"]
  73                insteadOf = <other url base>
  74------------
  75
  76For example, with this:
  77
  78------------
  79        [url "git://git.host.xz/"]
  80                insteadOf = host.xz:/path/to/
  81                insteadOf = work:
  82------------
  83
  84a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
  85rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".
  86
  87If you want to rewrite URLs for push only, you can create a
  88configuration section of the form:
  89
  90------------
  91        [url "<actual url base>"]
  92                pushInsteadOf = <other url base>
  93------------
  94
  95For example, with this:
  96
  97------------
  98        [url "ssh://example.org/"]
  99                pushInsteadOf = git://example.org/
 100------------
 101
 102a URL like "git://example.org/path/to/repo.git" will be rewritten to
 103"ssh://example.org/path/to/repo.git" for pushes, but pulls will still
 104use the original URL.