Git fork
1GIT URLS[[URLS]]
2----------------
3
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
9Git supports ssh, git, http, and https protocols (in addition, ftp
10and ftps can be used for fetching, but this is inefficient and
11deprecated; do not use them).
12
13The native transport (i.e. `git://` URL) does no authentication and
14should be used with caution on unsecured networks.
15
16The following syntaxes may be used with them:
17
18- `ssh://[<user>@]<host>[:<port>]/<path-to-git-repo>`
19- `git://<host>[:<port>]/<path-to-git-repo>`
20- `http[s]://<host>[:<port>]/<path-to-git-repo>`
21- `ftp[s]://<host>[:<port>]/<path-to-git-repo>`
22
23An alternative scp-like syntax may also be used with the ssh protocol:
24
25- `[<user>@]<host>:/<path-to-git-repo>`
26
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
33The ssh and git protocols additionally support `~<username>` expansion:
34
35- `ssh://[<user>@]<host>[:<port>]/~<user>/<path-to-git-repo>`
36- `git://<host>[:<port>]/~<user>/<path-to-git-repo>`
37- `[<user>@]<host>:~<user>/<path-to-git-repo>`
38
39For local repositories, also supported by Git natively, the following
40syntaxes may be used:
41
42- `/path/to/repo.git/`
43- `file:///path/to/repo.git/`
44
45ifndef::git-clone[]
46These two syntaxes are mostly equivalent, except when cloning, when
47the former implies `--local` option. See linkgit:git-clone[1] for
48details.
49endif::git-clone[]
50
51ifdef::git-clone[]
52These two syntaxes are mostly equivalent, except the former implies
53`--local` option.
54endif::git-clone[]
55
56`git clone`, `git fetch` and `git pull`, but not `git push`, will also
57accept a suitable bundle file. See linkgit:git-bundle[1].
58
59When Git doesn't know how to handle a certain transport protocol, it
60attempts 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
68invoked. See linkgit:gitremote-helpers[7] for details.
69
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[verse]
76--
77 [url "__<actual-url-base>__"]
78 insteadOf = _<other-url-base>_
79--
80
81For example, with this:
82
83------------
84 [url "git://git.host.xz/"]
85 insteadOf = host.xz:/path/to/
86 insteadOf = work:
87------------
88
89a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
90rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".
91
92If you want to rewrite URLs for push only, you can create a
93configuration section of the form:
94
95[verse]
96--
97 [url "__<actual-url-base>__"]
98 pushInsteadOf = _<other-url-base>_
99--
100
101For example, with this:
102
103------------
104 [url "ssh://example.org/"]
105 pushInsteadOf = git://example.org/
106------------
107
108a URL like "git://example.org/path/to/repo.git" will be rewritten to
109"ssh://example.org/path/to/repo.git" for pushes, but pulls will still
110use the original URL.