blob: 1e4994a31df750d76a7037a8eb0ea93a43f025c0 [file] [log] [blame]
<!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> [-l [-s]] [-q] [-n] [--bare] [-o &lt;name&gt;] [-u &lt;upload-pack&gt;]
[--reference &lt;repository&gt;]
&lt;repository&gt; [&lt;directory&gt;]</div></div>
</div>
<h2>DESCRIPTION</h2>
<div class="sectionbody">
<p>Clones a repository into a newly created directory. All remote
branch heads are copied under <tt>$GIT_DIR/refs/heads/</tt>, except
that the remote <tt>master</tt> is also copied to <tt>origin</tt> branch.</p>
<p>In addition, <tt>$GIT_DIR/remotes/origin</tt> file is set up to have
this line:</p>
<div class="literalblock">
<div class="content">
<pre><tt>Pull: master:origin</tt></pre>
</div></div>
<p>This is to help the typical workflow of working off of the
remote <tt>master</tt> branch. Every time <tt>git pull</tt> without argument
is run, the progress on the remote <tt>master</tt> branch is tracked by
copying it into the local <tt>origin</tt> branch, and merged into the
branch you are currently working on. Remote branches other than
<tt>master</tt> are also added there to be tracked.</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 &lt;repository&gt;
</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-clone-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>&lt;directory&gt;</tt> and placing the administrative
files in <tt>&lt;directory&gt;/.git</tt>, make the <tt>&lt;directory&gt;</tt>
itself the <tt>$GIT_DIR</tt>. This implies <tt>-n</tt> option. When
this option is used, neither the <tt>origin</tt> branch nor the
default <tt>remotes/origin</tt> file is created.
</p>
</dd>
<dt>
-o &lt;name&gt;
</dt>
<dd>
<p>
Instead of using the branch name <em>origin</em> to keep track
of the upstream repository, use &lt;name&gt; 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 &lt;upload-pack&gt;
</dt>
<dt>
-u &lt;upload-pack&gt;
</dt>
<dd>
<p>
When given, and the repository to clone from is handled
by <em>git-clone-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
the command to specify non-default path for the command
run on the other end.
</p>
</dd>
<dt>
&lt;repository&gt;
</dt>
<dd>
<p>
The (possibly remote) repository to clone from. It can
be any URL git-fetch supports.
</p>
</dd>
<dt>
&lt;directory&gt;
</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 &lt;torvalds@osdl.org&gt;</p>
</div>
<h2>Documentation</h2>
<div class="sectionbody">
<p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</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 05-May-2006 23:14:11 UTC
</div>
</div>
</body>
</html>