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