<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="generator" content="AsciiDoc 7.0.2" /> | |
<style type="text/css"> | |
/* Debug borders */ | |
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { | |
/* | |
border: 1px solid red; | |
*/ | |
} | |
body { | |
margin: 1em 5% 1em 5%; | |
} | |
a { color: blue; } | |
a:visited { color: fuchsia; } | |
em { | |
font-style: italic; | |
} | |
strong { | |
font-weight: bold; | |
} | |
tt { | |
color: navy; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
color: #527bbd; | |
font-family: sans-serif; | |
margin-top: 1.2em; | |
margin-bottom: 0.5em; | |
line-height: 1.3; | |
} | |
h1 { | |
border-bottom: 2px solid silver; | |
} | |
h2 { | |
border-bottom: 2px solid silver; | |
padding-top: 0.5em; | |
} | |
div.sectionbody { | |
font-family: serif; | |
margin-left: 0; | |
} | |
hr { | |
border: 1px solid silver; | |
} | |
p { | |
margin-top: 0.5em; | |
margin-bottom: 0.5em; | |
} | |
pre { | |
padding: 0; | |
margin: 0; | |
} | |
span#author { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
font-size: 1.2em; | |
} | |
span#email { | |
} | |
span#revision { | |
font-family: sans-serif; | |
} | |
div#footer { | |
font-family: sans-serif; | |
font-size: small; | |
border-top: 2px solid silver; | |
padding-top: 0.5em; | |
margin-top: 4.0em; | |
} | |
div#footer-text { | |
float: left; | |
padding-bottom: 0.5em; | |
} | |
div#footer-badges { | |
float: right; | |
padding-bottom: 0.5em; | |
} | |
div#preamble, | |
div.tableblock, div.imageblock, div.exampleblock, div.verseblock, | |
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | |
div.admonitionblock { | |
margin-right: 10%; | |
margin-top: 1.5em; | |
margin-bottom: 1.5em; | |
} | |
div.admonitionblock { | |
margin-top: 2.5em; | |
margin-bottom: 2.5em; | |
} | |
div.content { /* Block element content. */ | |
padding: 0; | |
} | |
/* Block element titles. */ | |
div.title, caption.title { | |
font-family: sans-serif; | |
font-weight: bold; | |
text-align: left; | |
margin-top: 1.0em; | |
margin-bottom: 0.5em; | |
} | |
div.title + * { | |
margin-top: 0; | |
} | |
td div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content + div.title { | |
margin-top: 0.0em; | |
} | |
div.sidebarblock > div.content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.listingblock > div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock > div.content { | |
padding-left: 2.0em; | |
} | |
div.quoteblock .attribution { | |
text-align: right; | |
} | |
div.admonitionblock .icon { | |
vertical-align: top; | |
font-size: 1.1em; | |
font-weight: bold; | |
text-decoration: underline; | |
color: #527bbd; | |
padding-right: 0.5em; | |
} | |
div.admonitionblock td.content { | |
padding-left: 0.5em; | |
border-left: 2px solid silver; | |
} | |
div.exampleblock > div.content { | |
border-left: 2px solid silver; | |
padding: 0.5em; | |
} | |
div.verseblock div.content { | |
white-space: pre; | |
} | |
div.imageblock div.content { padding-left: 0; } | |
div.imageblock img { border: 1px solid silver; } | |
span.image img { border-style: none; } | |
dl { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
dt { | |
margin-top: 0.5em; | |
margin-bottom: 0; | |
font-style: italic; | |
} | |
dd > *:first-child { | |
margin-top: 0; | |
} | |
ul, ol { | |
list-style-position: outside; | |
} | |
ol.olist2 { | |
list-style-type: lower-alpha; | |
} | |
div.tableblock > table { | |
border-color: #527bbd; | |
border-width: 3px; | |
} | |
thead { | |
font-family: sans-serif; | |
font-weight: bold; | |
} | |
tfoot { | |
font-weight: bold; | |
} | |
div.hlist { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
td.hlist1 { | |
vertical-align: top; | |
font-style: italic; | |
padding-right: 0.8em; | |
} | |
td.hlist2 { | |
vertical-align: top; | |
} | |
@media print { | |
div#footer-badges { display: none; } | |
} | |
include::./stylesheets/xhtml11-manpage.css[] | |
/* Workarounds for IE6's broken and incomplete CSS2. */ | |
div.sidebar-content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.sidebar-title, div.image-title { | |
font-family: sans-serif; | |
font-weight: bold; | |
margin-top: 0.0em; | |
margin-bottom: 0.5em; | |
} | |
div.listingblock div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock-content { | |
padding-left: 2.0em; | |
} | |
div.exampleblock-content { | |
border-left: 2px solid silver; | |
padding-left: 0.5em; | |
} | |
</style> | |
<title>git-clone(1)</title> | |
</head> | |
<body> | |
<div id="header"> | |
<h1> | |
git-clone(1) Manual Page | |
</h1> | |
<h2>NAME</h2> | |
<div class="sectionbody"> | |
<p>git-clone - | |
Clones a repository | |
</p> | |
</div> | |
</div> | |
<h2>SYNOPSIS</h2> | |
<div class="sectionbody"> | |
<div class="verseblock"> | |
<div class="content"><em>git-clone</em> [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare] | |
[-o <name>] [-u <upload-pack>] [--reference <repository>] | |
[--use-separate-remote | --no-separate-remote] <repository> | |
[<directory>]</div></div> | |
</div> | |
<h2>DESCRIPTION</h2> | |
<div class="sectionbody"> | |
<p>Clones a repository into a newly created directory, creates | |
remote-tracking branches for each branch in the cloned repository | |
(visible using <tt>git branch -r</tt>), and creates and checks out a master | |
branch equal to the cloned repository's master branch.</p> | |
<p>After the clone, a plain <tt>git fetch</tt> without arguments will update | |
all the remote-tracking branches, and a <tt>git pull</tt> without | |
arguments will in addition merge the remote master branch into the | |
current branch.</p> | |
<p>This default configuration is achieved by creating references to | |
the remote branch heads under <tt>$GIT_DIR/refs/remotes/origin</tt> and | |
by initializing <tt>remote.origin.url</tt> and <tt>remote.origin.fetch</tt> | |
configuration variables.</p> | |
</div> | |
<h2>OPTIONS</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
--local | |
</dt> | |
<dt> | |
-l | |
</dt> | |
<dd> | |
<p> | |
When the repository to clone from is on a local machine, | |
this flag bypasses normal "git aware" transport | |
mechanism and clones the repository by making a copy of | |
HEAD and everything under objects and refs directories. | |
The files under .git/objects/ directory are hardlinked | |
to save space when possible. | |
</p> | |
</dd> | |
<dt> | |
--shared | |
</dt> | |
<dt> | |
-s | |
</dt> | |
<dd> | |
<p> | |
When the repository to clone is on the local machine, | |
instead of using hard links, automatically setup | |
.git/objects/info/alternates to share the objects | |
with the source repository. The resulting repository | |
starts out without any object of its own. | |
</p> | |
</dd> | |
<dt> | |
--reference <repository> | |
</dt> | |
<dd> | |
<p> | |
If the reference repository is on the local machine | |
automatically setup .git/objects/info/alternates to | |
obtain objects from the reference repository. Using | |
an already existing repository as an alternate will | |
require less objects to be copied from the repository | |
being cloned, reducing network and local storage costs. | |
</p> | |
</dd> | |
<dt> | |
--quiet | |
</dt> | |
<dt> | |
-q | |
</dt> | |
<dd> | |
<p> | |
Operate quietly. This flag is passed to "rsync" and | |
"git-fetch-pack" commands when given. | |
</p> | |
</dd> | |
<dt> | |
-n | |
</dt> | |
<dd> | |
<p> | |
No checkout of HEAD is performed after the clone is complete. | |
</p> | |
</dd> | |
<dt> | |
--bare | |
</dt> | |
<dd> | |
<p> | |
Make a <em>bare</em> GIT repository. That is, instead of | |
creating <tt><directory></tt> and placing the administrative | |
files in <tt><directory>/.git</tt>, make the <tt><directory></tt> | |
itself the <tt>$GIT_DIR</tt>. This obviously implies the <tt>-n</tt> | |
because there is nowhere to check out the working tree. | |
Also the branch heads at the remote are copied directly | |
to corresponding local branch heads, without mapping | |
them to <tt>refs/remotes/origin/</tt>. When this option is | |
used, neither the <tt>origin</tt> branch nor the default | |
<tt>remotes/origin</tt> file is created. | |
</p> | |
</dd> | |
<dt> | |
--origin <name> | |
</dt> | |
<dt> | |
-o <name> | |
</dt> | |
<dd> | |
<p> | |
Instead of using the branch name <em>origin</em> to keep track | |
of the upstream repository, use <name> instead. Note | |
that the shorthand name stored in <tt>remotes/origin</tt> is | |
not affected, but the local branch name to pull the | |
remote <tt>master</tt> branch into is. | |
</p> | |
</dd> | |
<dt> | |
--upload-pack <upload-pack> | |
</dt> | |
<dt> | |
-u <upload-pack> | |
</dt> | |
<dd> | |
<p> | |
When given, and the repository to clone from is handled | |
by <em>git-fetch-pack</em>, <em>--exec=<upload-pack></em> is passed to | |
the command to specify non-default path for the command | |
run on the other end. | |
</p> | |
</dd> | |
<dt> | |
--template=<template_directory> | |
</dt> | |
<dd> | |
<p> | |
Specify the directory from which templates will be used; | |
if unset the templates are taken from the installation | |
defined default, typically <tt>/usr/share/git-core/templates</tt>. | |
</p> | |
</dd> | |
<dt> | |
--use-separate-remote | |
</dt> | |
<dd> | |
<p> | |
Save remotes heads under <tt>$GIT_DIR/remotes/origin/</tt> instead | |
of <tt>$GIT_DIR/refs/heads/</tt>. Only the local master branch is | |
saved in the latter. This is the default. | |
</p> | |
</dd> | |
<dt> | |
--no-separate-remote | |
</dt> | |
<dd> | |
<p> | |
Save remotes heads in the same namespace as the local | |
heads, `$GIT_DIR/refs/heads/'. In regular repositories, | |
this is a legacy setup git-clone created by default in | |
older Git versions, and will be removed before the next | |
major release. | |
</p> | |
</dd> | |
<dt> | |
<repository> | |
</dt> | |
<dd> | |
<p> | |
The (possibly remote) repository to clone from. It can | |
be any URL git-fetch supports. | |
</p> | |
</dd> | |
<dt> | |
<directory> | |
</dt> | |
<dd> | |
<p> | |
The name of a new directory to clone into. The "humanish" | |
part of the source repository is used if no directory is | |
explicitly given ("repo" for "/path/to/repo.git" and "foo" | |
for "host.xz:foo/.git"). Cloning into an existing directory | |
is not allowed. | |
</p> | |
</dd> | |
</dl> | |
</div> | |
<h2>Examples</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
Clone from upstream | |
</dt> | |
<dd> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6 | |
$ cd my2.6 | |
$ make</tt></pre> | |
</div></div> | |
</dd> | |
<dt> | |
Make a local clone that borrows from the current directory, without checking things out | |
</dt> | |
<dd> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git clone -l -s -n . ../copy | |
$ cd copy | |
$ git show-branch</tt></pre> | |
</div></div> | |
</dd> | |
<dt> | |
Clone from upstream while borrowing from an existing local directory | |
</dt> | |
<dd> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git clone --reference my2.6 \ | |
git://git.kernel.org/pub/scm/.../linux-2.7 \ | |
my2.7 | |
$ cd my2.7</tt></pre> | |
</div></div> | |
</dd> | |
<dt> | |
Create a bare repository to publish your changes to the public | |
</dt> | |
<dd> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git clone --bare -l /home/proj/.git /pub/scm/proj.git</tt></pre> | |
</div></div> | |
</dd> | |
<dt> | |
Create a repository on the kernel.org machine that borrows from Linus | |
</dt> | |
<dd> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git clone --bare -l -s /pub/scm/.../torvalds/linux-2.6.git \ | |
/pub/scm/.../me/subsys-2.6.git</tt></pre> | |
</div></div> | |
</dd> | |
</dl> | |
</div> | |
<h2>Author</h2> | |
<div class="sectionbody"> | |
<p>Written by Linus Torvalds <torvalds@osdl.org></p> | |
</div> | |
<h2>Documentation</h2> | |
<div class="sectionbody"> | |
<p>Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.</p> | |
</div> | |
<h2>GIT</h2> | |
<div class="sectionbody"> | |
<p>Part of the <a href="git.html">git(7)</a> suite</p> | |
</div> | |
<div id="footer"> | |
<div id="footer-text"> | |
Last updated 08-Dec-2006 07:23:38 UTC | |
</div> | |
</div> | |
</body> | |
</html> |