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