blob: 9ccb24677e95b8aff605c9020bc7a0537e23f751 [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
Junio C Hamanoa1952302013-07-01 21:31:1814The native transport (i.e. git:// URL) does no authentication and
15should be used with caution on unsecured networks.
16
Junio C Hamano6631a092012-10-10 22:50:5717The following syntaxes may be used with them:
Junio C Hamano0c053e82010-04-19 06:46:3418
Junio C Hamanodbb64592007-09-01 11:17:3919- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
Junio C Hamano0c053e82010-04-19 06:46:3420- 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/
Junio C Hamano40f2f8d2006-02-07 08:04:3924
Junio C Hamano0c053e82010-04-19 06:46:3425An alternative scp-like syntax may also be used with the ssh protocol:
Junio C Hamano40f2f8d2006-02-07 08:04:3926
Junio C Hamano0c053e82010-04-19 06:46:3427- {startsb}user@{endsb}host.xz:path/to/repo.git/
Junio C Hamano40f2f8d2006-02-07 08:04:3928
Junio C Hamano7e590a12013-06-02 23:46:5229This 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
Junio C Hamano0c053e82010-04-19 06:46:3435The 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
Junio C Hamano076ffcc2013-02-06 05:13:2141For local repositories, also supported by Git natively, the following
Junio C Hamano0c053e82010-04-19 06:46:3442syntaxes may be used:
Junio C Hamano40f2f8d2006-02-07 08:04:3943
Junio C Hamano40f2f8d2006-02-07 08:04:3944- /path/to/repo.git/
Junio C Hamanodc8f8de2013-06-05 22:58:0745- \file:///path/to/repo.git/
Junio C Hamanob1d6e882007-08-11 08:30:1646
Junio C Hamano63777e22007-11-17 20:52:1647ifndef::git-clone[]
Junio C Hamano0c053e82010-04-19 06:46:3448These two syntaxes are mostly equivalent, except when cloning, when
49the former implies --local option. See linkgit:git-clone[1] for
50details.
Junio C Hamano63777e22007-11-17 20:52:1651endif::git-clone[]
52
53ifdef::git-clone[]
Junio C Hamano0c053e82010-04-19 06:46:3454These two syntaxes are mostly equivalent, except the former implies
55--local option.
Junio C Hamano63777e22007-11-17 20:52:1656endif::git-clone[]
Junio C Hamano24bc09a2008-02-28 00:27:4457
Junio C Hamano076ffcc2013-02-06 05:13:2158When Git doesn't know how to handle a certain transport protocol, it
Junio C Hamano0c053e82010-04-19 06:46:3459attempts 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
Junio C Hamanob5e079f2013-02-08 00:02:5267invoked. See linkgit:gitremote-helpers[1] for details.
Junio C Hamano24bc09a2008-02-28 00:27:4468
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>"]
76insteadOf = <other url base>
77------------
78
79For example, with this:
80
81------------
82[url "git://git.host.xz/"]
83insteadOf = host.xz:/path/to/
84insteadOf = 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
Junio C Hamano7df6dcf2009-09-13 09:51:1790If you want to rewrite URLs for push only, you can create a
91configuration section of the form:
92
93------------
94[url "<actual url base>"]
95pushInsteadOf = <other url base>
96------------
97
98For example, with this:
99
100------------
101[url "ssh://example.org/"]
102pushInsteadOf = 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.