Information Technology Reference
In-Depth Information
2-7. Cloning a bare repository
Problem
You want to create a bare clone of a repository from Recipe 2-3.
Solution
Issue the following commands:
$ cd git-recipes
$ git clone --bare 02-03 02-06
Enter the
02-06/
directory and check its contents:
$ cd 02-06
$ ls -la
The above command will print the output identical to
Figure 2-6
.
How It Works
The git clone command takes an optional parameter
--bare
. You can use the
--
bare
parameter to create a bare repository. A
bare repository
contains only the con-
tents of the git directory. It does not contain the working directory. This type of reposit-
ory is used for synchronization purposes only. We will use it in
chapter 10
.
Remember
The bare repository can be created with the
$ git clone --bare
[URL]
command. This type of repository doesn't contain the working directory. Its
content is equivalent to the content of a
.git
directory in a non-bare repository.