Git 2.0.1
[git.git] / Documentation / urls.txt
blob9ccb24677e95b8aff605c9020bc7a0537e23f751
1 GIT URLS[[URLS]]
2 ----------------
4 In general, URLs contain information about the transport protocol, the
5 address of the remote server, and the path to the repository.
6 Depending on the transport protocol, some of this information may be
7 absent.
9 Git supports ssh, git, http, and https protocols (in addition, ftp,
10 and ftps can be used for fetching and rsync can be used for fetching
11 and pushing, but these are inefficient and deprecated; do not use
12 them).
14 The native transport (i.e. git:// URL) does no authentication and
15 should be used with caution on unsecured networks.
17 The following syntaxes may be used with them:
19 - ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
20 - 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/
25 An alternative scp-like syntax may also be used with the ssh protocol:
27 - {startsb}user@{endsb}host.xz:path/to/repo.git/
29 This syntax is only recognized if there are no slashes before the
30 first colon. This helps differentiate a local path that contains a
31 colon. For example the local path `foo:bar` could be specified as an
32 absolute path or `./foo:bar` to avoid being misinterpreted as an ssh
33 url.
35 The ssh and git protocols additionally support ~username expansion:
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/
41 For local repositories, also supported by Git natively, the following
42 syntaxes may be used:
44 - /path/to/repo.git/
45 - \file:///path/to/repo.git/
47 ifndef::git-clone[]
48 These two syntaxes are mostly equivalent, except when cloning, when
49 the former implies --local option. See linkgit:git-clone[1] for
50 details.
51 endif::git-clone[]
53 ifdef::git-clone[]
54 These two syntaxes are mostly equivalent, except the former implies
55 --local option.
56 endif::git-clone[]
58 When Git doesn't know how to handle a certain transport protocol, it
59 attempts to use the 'remote-<transport>' remote helper, if one
60 exists. To explicitly request a remote helper, the following syntax
61 may be used:
63 - <transport>::<address>
65 where <address> may be a path, a server and path, or an arbitrary
66 URL-like string recognized by the specific remote helper being
67 invoked. See linkgit:gitremote-helpers[1] for details.
69 If there are a large number of similarly-named remote repositories and
70 you want to use a different format for them (such that the URLs you
71 use will be rewritten into URLs that work), you can create a
72 configuration section of the form:
74 ------------
75         [url "<actual url base>"]
76                 insteadOf = <other url base>
77 ------------
79 For example, with this:
81 ------------
82         [url "git://git.host.xz/"]
83                 insteadOf = host.xz:/path/to/
84                 insteadOf = work:
85 ------------
87 a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
88 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".
90 If you want to rewrite URLs for push only, you can create a
91 configuration section of the form:
93 ------------
94         [url "<actual url base>"]
95                 pushInsteadOf = <other url base>
96 ------------
98 For example, with this:
100 ------------
101         [url "ssh://example.org/"]
102                 pushInsteadOf = git://example.org/
103 ------------
105 a 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
107 use the original URL.