blob: 5e185f87c20a2124a7fb9bf2046f6035942b4f92 [file] [log] [blame]
Junio C Hamano40f2f8d2006-02-07 08:04:391GIT URLS[[URLS]]
2----------------
3
Junio C Hamano0c053e82010-04-19 06:46:344In 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.
Junio C Hamano40f2f8d2006-02-07 08:04:398
Junio C Hamano6631a092012-10-10 22:50:579Git 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:
Junio C Hamano0c053e82010-04-19 06:46:3415
Junio C Hamanodbb64592007-09-01 11:17:3916- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
Junio C Hamano0c053e82010-04-19 06:46:3417- 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/
Junio C Hamano40f2f8d2006-02-07 08:04:3921
Junio C Hamano0c053e82010-04-19 06:46:3422An alternative scp-like syntax may also be used with the ssh protocol:
Junio C Hamano40f2f8d2006-02-07 08:04:3923
Junio C Hamano0c053e82010-04-19 06:46:3424- {startsb}user@{endsb}host.xz:path/to/repo.git/
Junio C Hamano40f2f8d2006-02-07 08:04:3925
Junio C Hamano7e590a12013-06-02 23:46:5226This 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
Junio C Hamano0c053e82010-04-19 06:46:3432The 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
Junio C Hamano076ffcc2013-02-06 05:13:2138For local repositories, also supported by Git natively, the following
Junio C Hamano0c053e82010-04-19 06:46:3439syntaxes may be used:
Junio C Hamano40f2f8d2006-02-07 08:04:3940
Junio C Hamano40f2f8d2006-02-07 08:04:3941- /path/to/repo.git/
Junio C Hamanodc8f8de2013-06-05 22:58:0742- \file:///path/to/repo.git/
Junio C Hamanob1d6e882007-08-11 08:30:1643
Junio C Hamano63777e22007-11-17 20:52:1644ifndef::git-clone[]
Junio C Hamano0c053e82010-04-19 06:46:3445These two syntaxes are mostly equivalent, except when cloning, when
46the former implies --local option. See linkgit:git-clone[1] for
47details.
Junio C Hamano63777e22007-11-17 20:52:1648endif::git-clone[]
49
50ifdef::git-clone[]
Junio C Hamano0c053e82010-04-19 06:46:3451These two syntaxes are mostly equivalent, except the former implies
52--local option.
Junio C Hamano63777e22007-11-17 20:52:1653endif::git-clone[]
Junio C Hamano24bc09a2008-02-28 00:27:4454
Junio C Hamano076ffcc2013-02-06 05:13:2155When Git doesn't know how to handle a certain transport protocol, it
Junio C Hamano0c053e82010-04-19 06:46:3456attempts 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
Junio C Hamanob5e079f2013-02-08 00:02:5264invoked. See linkgit:gitremote-helpers[1] for details.
Junio C Hamano24bc09a2008-02-28 00:27:4465
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>"]
73insteadOf = <other url base>
74------------
75
76For example, with this:
77
78------------
79[url "git://git.host.xz/"]
80insteadOf = host.xz:/path/to/
81insteadOf = 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
Junio C Hamano7df6dcf2009-09-13 09:51:1787If you want to rewrite URLs for push only, you can create a
88configuration section of the form:
89
90------------
91[url "<actual url base>"]
92pushInsteadOf = <other url base>
93------------
94
95For example, with this:
96
97------------
98[url "ssh://example.org/"]
99pushInsteadOf = 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.