Name

clone

Synopsis

git clone repository [local-directory]

Make a copy of repository (which can be a local or remote Git repository) in local-directory. By default, if repository is on the local filesystem, Git will use hardlinks to copy the .git/objects folder to minimize disk space waste.

Available forms for repository are:

/path/repo.git
rsync://hostname/path/repo.git
http://hostname/path/repo.git
https://hostname/path/repo.git
git://host/path/repo.git
ssh://host/path/repo.git
ssh://user@host:port/path/repo.git
host:path/repo.git
user@host:path/repo.git

Options

-s, --shared
--no-hardlinks
--reference other-parent-repository
-q, --quiet
-n, --no-checkout
--bare
-o origin-name, --origin origin-name
--depth shallow-clone-depth

Examples

To clone the Linux kernel repository:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/
torvalds/linux-2.6.git linux-2.6

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.