2006-02-06 00:29:49 +01:00
|
|
|
GIT URLS[[URLS]]
|
|
|
|
----------------
|
|
|
|
|
2010-04-06 10:38:19 +02:00
|
|
|
In general, URLs contain information about the transport protocol, the
|
|
|
|
address of the remote server, and the path to the repository.
|
|
|
|
Depending on the transport protocol, some of this information may be
|
|
|
|
absent.
|
|
|
|
|
2012-10-08 19:26:53 +02:00
|
|
|
Git supports ssh, git, http, and https protocols (in addition, ftp,
|
|
|
|
and ftps can be used for fetching and rsync can be used for fetching
|
|
|
|
and pushing, but these are inefficient and deprecated; do not use
|
|
|
|
them).
|
|
|
|
|
|
|
|
The following syntaxes may be used with them:
|
2006-02-06 00:29:49 +01:00
|
|
|
|
2007-09-01 11:36:31 +02:00
|
|
|
- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
|
2010-04-06 10:38:19 +02:00
|
|
|
- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
|
|
|
|
- http{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
|
|
|
|
- ftp{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
|
|
|
|
- rsync://host.xz/path/to/repo.git/
|
2006-02-06 00:29:49 +01:00
|
|
|
|
2010-04-06 10:38:19 +02:00
|
|
|
An alternative scp-like syntax may also be used with the ssh protocol:
|
2006-02-06 00:29:49 +01:00
|
|
|
|
2010-04-06 10:38:19 +02:00
|
|
|
- {startsb}user@{endsb}host.xz:path/to/repo.git/
|
2006-02-06 00:29:49 +01:00
|
|
|
|
2010-04-06 10:38:19 +02:00
|
|
|
The ssh and git protocols additionally support ~username expansion:
|
|
|
|
|
|
|
|
- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
|
|
|
|
- git://host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
|
|
|
|
- {startsb}user@{endsb}host.xz:/~{startsb}user{endsb}/path/to/repo.git/
|
|
|
|
|
2013-01-21 20:17:53 +01:00
|
|
|
For local repositories, also supported by Git natively, the following
|
2010-04-06 10:38:19 +02:00
|
|
|
syntaxes may be used:
|
2006-02-06 00:29:49 +01:00
|
|
|
|
2006-02-05 23:43:47 +01:00
|
|
|
- /path/to/repo.git/
|
git-clone: aggressively optimize local clone behaviour.
This changes the behaviour of cloning from a repository on the
local machine, by defaulting to "-l" (use hardlinks to share
files under .git/objects) and making "-l" a no-op. A new
option, --no-hardlinks, is also added to cause file-level copy
of files under .git/objects while still avoiding the normal
"pack to pipe, then receive and index pack" network transfer
overhead. The old behaviour of local cloning without -l nor -s
is availble by specifying the source repository with the newly
introduced file:///path/to/repo.git/ syntax (i.e. "same as
network" cloning).
* With --no-hardlinks (i.e. have all .git/objects/ copied via
cpio) would not catch the source repository corruption, and
also risks corrupted recipient repository if an
alpha-particle hits memory cell while indexing and resolving
deltas. As long as the recipient is created uncorrupted, you
have a good back-up.
* same-as-network is expensive, but it would catch the breakage
of the source repository. It still risks corrupted recipient
repository due to hardware failure. As long as the recipient
is created uncorrupted, you have a good back-up.
* The new default on the same filesystem, as long as the source
repository is healthy, it is very likely that the recipient
would be, too. Also it is very cheap. You do not get any
back-up benefit, though.
None of the method is resilient against the source repository
corruption, so let's discount that from the comparison. Then
the difference with and without --no-hardlinks matters primarily
if you value the back-up benefit or not. If you want to use the
cloned repository as a back-up, then it is cheaper to do a clone
with --no-hardlinks and two git-fsck (source before clone,
recipient after clone) than same-as-network clone, especially as
you are likely to do a git-fsck on the recipient if you are so
paranoid anyway.
Which leads me to believe that being able to use file:/// is
probably a good idea, if only for testability, but probably of
little practical value. We default to hardlinked clone for
everyday use, and paranoids can use --no-hardlinks as a way to
make a back-up.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-02 08:42:36 +02:00
|
|
|
- file:///path/to/repo.git/
|
|
|
|
|
2007-11-16 19:43:16 +01:00
|
|
|
ifndef::git-clone[]
|
2010-04-06 10:38:19 +02:00
|
|
|
These two syntaxes are mostly equivalent, except when cloning, when
|
|
|
|
the former implies --local option. See linkgit:git-clone[1] for
|
|
|
|
details.
|
2007-11-16 19:43:16 +01:00
|
|
|
endif::git-clone[]
|
|
|
|
|
|
|
|
ifdef::git-clone[]
|
2010-04-06 10:38:19 +02:00
|
|
|
These two syntaxes are mostly equivalent, except the former implies
|
|
|
|
--local option.
|
2007-11-16 19:43:16 +01:00
|
|
|
endif::git-clone[]
|
2008-02-20 19:43:53 +01:00
|
|
|
|
2013-01-21 20:17:53 +01:00
|
|
|
When Git doesn't know how to handle a certain transport protocol, it
|
2010-04-06 10:38:19 +02:00
|
|
|
attempts to use the 'remote-<transport>' remote helper, if one
|
|
|
|
exists. To explicitly request a remote helper, the following syntax
|
|
|
|
may be used:
|
|
|
|
|
|
|
|
- <transport>::<address>
|
|
|
|
|
|
|
|
where <address> may be a path, a server and path, or an arbitrary
|
|
|
|
URL-like string recognized by the specific remote helper being
|
2013-01-31 22:59:50 +01:00
|
|
|
invoked. See linkgit:gitremote-helpers[1] for details.
|
2008-02-20 19:43:53 +01:00
|
|
|
|
|
|
|
If there are a large number of similarly-named remote repositories and
|
|
|
|
you want to use a different format for them (such that the URLs you
|
|
|
|
use will be rewritten into URLs that work), you can create a
|
|
|
|
configuration section of the form:
|
|
|
|
|
|
|
|
------------
|
|
|
|
[url "<actual url base>"]
|
|
|
|
insteadOf = <other url base>
|
|
|
|
------------
|
|
|
|
|
|
|
|
For example, with this:
|
|
|
|
|
|
|
|
------------
|
|
|
|
[url "git://git.host.xz/"]
|
|
|
|
insteadOf = host.xz:/path/to/
|
|
|
|
insteadOf = work:
|
|
|
|
------------
|
|
|
|
|
|
|
|
a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
|
|
|
|
rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".
|
|
|
|
|
2009-09-07 10:56:33 +02:00
|
|
|
If you want to rewrite URLs for push only, you can create a
|
|
|
|
configuration section of the form:
|
|
|
|
|
|
|
|
------------
|
|
|
|
[url "<actual url base>"]
|
|
|
|
pushInsteadOf = <other url base>
|
|
|
|
------------
|
|
|
|
|
|
|
|
For example, with this:
|
|
|
|
|
|
|
|
------------
|
|
|
|
[url "ssh://example.org/"]
|
|
|
|
pushInsteadOf = git://example.org/
|
|
|
|
------------
|
|
|
|
|
|
|
|
a URL like "git://example.org/path/to/repo.git" will be rewritten to
|
|
|
|
"ssh://example.org/path/to/repo.git" for pushes, but pulls will still
|
|
|
|
use the original URL.
|