blob: 1c229d758152b6377e23125967e2041a5fd5be5a [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,
Junio C Hamanof85ef632016-02-17 22:31:0610and ftps can be used for fetching, but this is inefficient and
11deprecated; do not use it).
Junio C Hamano6631a092012-10-10 22:50:5712
Junio C Hamanoa1952302013-07-01 21:31:1813The native transport (i.e. git:// URL) does no authentication and
14should be used with caution on unsecured networks.
15
Junio C Hamano6631a092012-10-10 22:50:5716The following syntaxes may be used with them:
Junio C Hamano0c053e82010-04-19 06:46:3417
Junio C Hamanodbb64592007-09-01 11:17:3918- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
Junio C Hamano0c053e82010-04-19 06:46:3419- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
20- http{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
21- ftp{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
Junio C Hamano40f2f8d2006-02-07 08:04:3922
Junio C Hamano0c053e82010-04-19 06:46:3423An alternative scp-like syntax may also be used with the ssh protocol:
Junio C Hamano40f2f8d2006-02-07 08:04:3924
Junio C Hamano0c053e82010-04-19 06:46:3425- {startsb}user@{endsb}host.xz:path/to/repo.git/
Junio C Hamano40f2f8d2006-02-07 08:04:3926
Junio C Hamano7e590a12013-06-02 23:46:5227This syntax is only recognized if there are no slashes before the
28first colon. This helps differentiate a local path that contains a
29colon. For example the local path `foo:bar` could be specified as an
30absolute path or `./foo:bar` to avoid being misinterpreted as an ssh
31url.
32
Junio C Hamano0c053e82010-04-19 06:46:3433The ssh and git protocols additionally support ~username expansion:
34
35- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
36- git://host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
37- {startsb}user@{endsb}host.xz:/~{startsb}user{endsb}/path/to/repo.git/
38
Junio C Hamano076ffcc2013-02-06 05:13:2139For local repositories, also supported by Git natively, the following
Junio C Hamano0c053e82010-04-19 06:46:3440syntaxes may be used:
Junio C Hamano40f2f8d2006-02-07 08:04:3941
Junio C Hamano40f2f8d2006-02-07 08:04:3942- /path/to/repo.git/
Junio C Hamanodc8f8de2013-06-05 22:58:0743- \file:///path/to/repo.git/
Junio C Hamanob1d6e882007-08-11 08:30:1644
Junio C Hamano63777e22007-11-17 20:52:1645ifndef::git-clone[]
Junio C Hamano0c053e82010-04-19 06:46:3446These two syntaxes are mostly equivalent, except when cloning, when
47the former implies --local option. See linkgit:git-clone[1] for
48details.
Junio C Hamano63777e22007-11-17 20:52:1649endif::git-clone[]
50
51ifdef::git-clone[]
Junio C Hamano0c053e82010-04-19 06:46:3452These two syntaxes are mostly equivalent, except the former implies
53--local option.
Junio C Hamano63777e22007-11-17 20:52:1654endif::git-clone[]
Junio C Hamano24bc09a2008-02-28 00:27:4455
Junio C Hamanob4896852019-12-10 23:15:0956'git clone', 'git fetch' and 'git pull', but not 'git push', will also
57accept a suitable bundle file. See linkgit:git-bundle[1].
58
Junio C Hamano076ffcc2013-02-06 05:13:2159When Git doesn't know how to handle a certain transport protocol, it
Junio C Hamano0c053e82010-04-19 06:46:3460attempts to use the 'remote-<transport>' remote helper, if one
61exists. To explicitly request a remote helper, the following syntax
62may be used:
63
64- <transport>::<address>
65
66where <address> may be a path, a server and path, or an arbitrary
67URL-like string recognized by the specific remote helper being
Junio C Hamanob5513772019-04-22 03:38:3968invoked. See linkgit:gitremote-helpers[7] for details.
Junio C Hamano24bc09a2008-02-28 00:27:4469
70If there are a large number of similarly-named remote repositories and
71you want to use a different format for them (such that the URLs you
72use will be rewritten into URLs that work), you can create a
73configuration section of the form:
74
75------------
76[url "<actual url base>"]
77insteadOf = <other url base>
78------------
79
80For example, with this:
81
82------------
83[url "git://git.host.xz/"]
84insteadOf = host.xz:/path/to/
85insteadOf = work:
86------------
87
88a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
89rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".
90
Junio C Hamano7df6dcf2009-09-13 09:51:1791If you want to rewrite URLs for push only, you can create a
92configuration section of the form:
93
94------------
95[url "<actual url base>"]
96pushInsteadOf = <other url base>
97------------
98
99For example, with this:
100
101------------
102[url "ssh://example.org/"]
103pushInsteadOf = git://example.org/
104------------
105
106a URL like "git://example.org/path/to/repo.git" will be rewritten to
107"ssh://example.org/path/to/repo.git" for pushes, but pulls will still
108use the original URL.