Information Technology Reference
In-Depth Information
Along with the four network protocols presented in Table 11-1 , git can handle local
URLs. You already are quite familiar with commands such as:
$ git clone a/local/path/repo.git
This command clones a repository available in local directory a/local/path/
repo.git . A local clone also can be created with:
$ git clone file:///a/local/path/repo.git
The difference between the two URLs:
a/local/path/repo.git
file:///a/local/path/repo.git
is that the first one allows git to use a standard filesystem operations (such as copy) and
hard links. The second URL doesn't allow git to create hard links and the data transfer
is executed in networked style, not with cp command. This is less efficient, of course,
but creates a fresh copy, without any hard links.
When we combine the four networked protocols from Table 11-1 with the two local
ones we get the complete list of protocols used by git. The protocol used for a reposit-
ory is encoded in the URL. Table 11-2 presents an example of URLs for all protocols
used by git. If you know the URL of the repository you can easily guess the protocol
that git will use.
Table 11-2 . The protocol used by git can be guessed from the repository's URL
Protocol URL used for cloning
local
$ git clone some/local/path/dir/repo.git
$git clone file:///pub/git/dir/repo.git
$git clone file:///c/dir/repo.git
file
$git clone ssh://user@host:dir/repo.git
$git clone user@host:dir/repo.git
$git clone host:/dir/repo.git
ssh
http
$git clone http://host/dir/repo.git
https
$git clone https://host/dir/repo.git
$git clone git://host/dir/repo.git
git
 
 
Search WWH ::




Custom Search