]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/urls.txt
t4034: abstract away SHA-1-specific constants
[thirdparty/git.git] / Documentation / urls.txt
CommitLineData
85a97d4e
BF
1GIT URLS[[URLS]]
2----------------
3
5ce4f4e3
RR
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
6347e716 9Git supports ssh, git, http, and https protocols (in addition, ftp,
0d0bac67
JK
10and ftps can be used for fetching, but this is inefficient and
11deprecated; do not use it).
6347e716 12
20618016
FT
13The native transport (i.e. git:// URL) does no authentication and
14should be used with caution on unsecured networks.
15
6347e716 16The following syntaxes may be used with them:
85a97d4e 17
2e776665 18- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
5ce4f4e3
RR
19- 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/
85a97d4e 22
5ce4f4e3 23An alternative scp-like syntax may also be used with the ssh protocol:
85a97d4e 24
5ce4f4e3 25- {startsb}user@{endsb}host.xz:path/to/repo.git/
85a97d4e 26
60003340
NTND
27This 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
5ce4f4e3
RR
33The 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
2de9b711 39For local repositories, also supported by Git natively, the following
5ce4f4e3 40syntaxes may be used:
85a97d4e 41
3598a308 42- /path/to/repo.git/
4c32e361 43- \file:///path/to/repo.git/
3d5c418f 44
347989f4 45ifndef::git-clone[]
5ce4f4e3
RR
46These two syntaxes are mostly equivalent, except when cloning, when
47the former implies --local option. See linkgit:git-clone[1] for
48details.
347989f4
SO
49endif::git-clone[]
50
51ifdef::git-clone[]
5ce4f4e3
RR
52These two syntaxes are mostly equivalent, except the former implies
53--local option.
347989f4 54endif::git-clone[]
55029ae4 55
2de9b711 56When Git doesn't know how to handle a certain transport protocol, it
5ce4f4e3
RR
57attempts to use the 'remote-<transport>' remote helper, if one
58exists. To explicitly request a remote helper, the following syntax
59may be used:
60
61- <transport>::<address>
62
63where <address> may be a path, a server and path, or an arbitrary
64URL-like string recognized by the specific remote helper being
439cc746 65invoked. See linkgit:gitremote-helpers[7] for details.
55029ae4
DB
66
67If there are a large number of similarly-named remote repositories and
68you want to use a different format for them (such that the URLs you
69use will be rewritten into URLs that work), you can create a
70configuration section of the form:
71
72------------
73 [url "<actual url base>"]
74 insteadOf = <other url base>
75------------
76
77For example, with this:
78
79------------
80 [url "git://git.host.xz/"]
81 insteadOf = host.xz:/path/to/
82 insteadOf = work:
83------------
84
85a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
86rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".
87
1c2eafb8
JT
88If you want to rewrite URLs for push only, you can create a
89configuration section of the form:
90
91------------
92 [url "<actual url base>"]
93 pushInsteadOf = <other url base>
94------------
95
96For example, with this:
97
98------------
99 [url "ssh://example.org/"]
100 pushInsteadOf = git://example.org/
101------------
102
103a URL like "git://example.org/path/to/repo.git" will be rewritten to
104"ssh://example.org/path/to/repo.git" for pushes, but pulls will still
105use the original URL.