Autogenerated HTML docs for v1.7.5-134-g1c08
[git/jnareb-git.git] / git-clone.html
blobd1b52d02a49814c7b902ace1505b824216342fee
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-clone(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-clone(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-clone -
411 Clone a repository into a new directory
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git clone</em> [--template=&lt;template_directory&gt;]
419 [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
420 [-o &lt;name&gt;] [-b &lt;name&gt;] [-u &lt;upload-pack&gt;] [--reference &lt;repository&gt;]
421 [--separate-git-dir|-L &lt;git dir&gt;]
422 [--depth &lt;depth&gt;] [--recursive|--recurse-submodules] [--] &lt;repository&gt;
423 [&lt;directory&gt;]</div>
424 <div class="verseblock-attribution">
425 </div></div>
426 </div>
427 <h2 id="_description">DESCRIPTION</h2>
428 <div class="sectionbody">
429 <div class="paragraph"><p>Clones a repository into a newly created directory, creates
430 remote-tracking branches for each branch in the cloned repository
431 (visible using <tt>git branch -r</tt>), and creates and checks out an
432 initial branch that is forked from the cloned repository&#8217;s
433 currently active branch.</p></div>
434 <div class="paragraph"><p>After the clone, a plain <tt>git fetch</tt> without arguments will update
435 all the remote-tracking branches, and a <tt>git pull</tt> without
436 arguments will in addition merge the remote master branch into the
437 current master branch, if any.</p></div>
438 <div class="paragraph"><p>This default configuration is achieved by creating references to
439 the remote branch heads under <tt>refs/remotes/origin</tt> and
440 by initializing <tt>remote.origin.url</tt> and <tt>remote.origin.fetch</tt>
441 configuration variables.</p></div>
442 </div>
443 <h2 id="_options">OPTIONS</h2>
444 <div class="sectionbody">
445 <div class="dlist"><dl>
446 <dt class="hdlist1">
447 --local
448 </dt>
449 <dt class="hdlist1">
451 </dt>
452 <dd>
454 When the repository to clone from is on a local machine,
455 this flag bypasses the normal "git aware" transport
456 mechanism and clones the repository by making a copy of
457 HEAD and everything under objects and refs directories.
458 The files under <tt>.git/objects/</tt> directory are hardlinked
459 to save space when possible. This is now the default when
460 the source repository is specified with <tt>/path/to/repo</tt>
461 syntax, so it essentially is a no-op option. To force
462 copying instead of hardlinking (which may be desirable
463 if you are trying to make a back-up of your repository),
464 but still avoid the usual "git aware" transport
465 mechanism, <tt>--no-hardlinks</tt> can be used.
466 </p>
467 </dd>
468 <dt class="hdlist1">
469 --no-hardlinks
470 </dt>
471 <dd>
473 Optimize the cloning process from a repository on a
474 local filesystem by copying files under <tt>.git/objects</tt>
475 directory.
476 </p>
477 </dd>
478 <dt class="hdlist1">
479 --shared
480 </dt>
481 <dt class="hdlist1">
483 </dt>
484 <dd>
486 When the repository to clone is on the local machine,
487 instead of using hard links, automatically setup
488 <tt>.git/objects/info/alternates</tt> to share the objects
489 with the source repository. The resulting repository
490 starts out without any object of its own.
491 </p>
492 <div class="paragraph"><p><strong>NOTE</strong>: this is a possibly dangerous operation; do <strong>not</strong> use
493 it unless you understand what it does. If you clone your
494 repository using this option and then delete branches (or use any
495 other git command that makes any existing commit unreferenced) in the
496 source repository, some objects may become unreferenced (or dangling).
497 These objects may be removed by normal git operations (such as <tt>git commit</tt>)
498 which automatically call <tt>git gc --auto</tt>. (See <a href="git-gc.html">git-gc(1)</a>.)
499 If these objects are removed and were referenced by the cloned repository,
500 then the cloned repository will become corrupt.</p></div>
501 <div class="paragraph"><p>Note that running <tt>git repack</tt> without the <tt>-l</tt> option in a repository
502 cloned with <tt>-s</tt> will copy objects from the source repository into a pack
503 in the cloned repository, removing the disk space savings of <tt>clone -s</tt>.
504 It is safe, however, to run <tt>git gc</tt>, which uses the <tt>-l</tt> option by
505 default.</p></div>
506 <div class="paragraph"><p>If you want to break the dependency of a repository cloned with <tt>-s</tt> on
507 its source repository, you can simply run <tt>git repack -a</tt> to copy all
508 objects from the source repository into a pack in the cloned repository.</p></div>
509 </dd>
510 <dt class="hdlist1">
511 --reference &lt;repository&gt;
512 </dt>
513 <dd>
515 If the reference repository is on the local machine,
516 automatically setup <tt>.git/objects/info/alternates</tt> to
517 obtain objects from the reference repository. Using
518 an already existing repository as an alternate will
519 require fewer objects to be copied from the repository
520 being cloned, reducing network and local storage costs.
521 </p>
522 <div class="paragraph"><p><strong>NOTE</strong>: see the NOTE for the <tt>--shared</tt> option.</p></div>
523 </dd>
524 <dt class="hdlist1">
525 --quiet
526 </dt>
527 <dt class="hdlist1">
529 </dt>
530 <dd>
532 Operate quietly. Progress is not reported to the standard
533 error stream. This flag is also passed to the &#8216;rsync&#8217;
534 command when given.
535 </p>
536 </dd>
537 <dt class="hdlist1">
538 --verbose
539 </dt>
540 <dt class="hdlist1">
542 </dt>
543 <dd>
545 Run verbosely. Does not affect the reporting of progress status
546 to the standard error stream.
547 </p>
548 </dd>
549 <dt class="hdlist1">
550 --progress
551 </dt>
552 <dd>
554 Progress status is reported on the standard error stream
555 by default when it is attached to a terminal, unless -q
556 is specified. This flag forces progress status even if the
557 standard error stream is not directed to a terminal.
558 </p>
559 </dd>
560 <dt class="hdlist1">
561 --no-checkout
562 </dt>
563 <dt class="hdlist1">
565 </dt>
566 <dd>
568 No checkout of HEAD is performed after the clone is complete.
569 </p>
570 </dd>
571 <dt class="hdlist1">
572 --bare
573 </dt>
574 <dd>
576 Make a <em>bare</em> GIT repository. That is, instead of
577 creating <tt>&lt;directory&gt;</tt> and placing the administrative
578 files in <tt>&lt;directory&gt;/.git</tt>, make the <tt>&lt;directory&gt;</tt>
579 itself the <tt>$GIT_DIR</tt>. This obviously implies the <tt>-n</tt>
580 because there is nowhere to check out the working tree.
581 Also the branch heads at the remote are copied directly
582 to corresponding local branch heads, without mapping
583 them to <tt>refs/remotes/origin/</tt>. When this option is
584 used, neither remote-tracking branches nor the related
585 configuration variables are created.
586 </p>
587 </dd>
588 <dt class="hdlist1">
589 --mirror
590 </dt>
591 <dd>
593 Set up a mirror of the source repository. This implies <tt>--bare</tt>.
594 Compared to <tt>--bare</tt>, <tt>--mirror</tt> not only maps local branches of the
595 source to local branches of the target, it maps all refs (including
596 remote-tracking branches, notes etc.) and sets up a refspec configuration such
597 that all these refs are overwritten by a <tt>git remote update</tt> in the
598 target repository.
599 </p>
600 </dd>
601 <dt class="hdlist1">
602 --origin &lt;name&gt;
603 </dt>
604 <dt class="hdlist1">
605 -o &lt;name&gt;
606 </dt>
607 <dd>
609 Instead of using the remote name <tt>origin</tt> to keep track
610 of the upstream repository, use <tt>&lt;name&gt;</tt>.
611 </p>
612 </dd>
613 <dt class="hdlist1">
614 --branch &lt;name&gt;
615 </dt>
616 <dt class="hdlist1">
617 -b &lt;name&gt;
618 </dt>
619 <dd>
621 Instead of pointing the newly created HEAD to the branch pointed
622 to by the cloned repository&#8217;s HEAD, point to <tt>&lt;name&gt;</tt> branch
623 instead. In a non-bare repository, this is the branch that will
624 be checked out.
625 </p>
626 </dd>
627 <dt class="hdlist1">
628 --upload-pack &lt;upload-pack&gt;
629 </dt>
630 <dt class="hdlist1">
631 -u &lt;upload-pack&gt;
632 </dt>
633 <dd>
635 When given, and the repository to clone from is accessed
636 via ssh, this specifies a non-default path for the command
637 run on the other end.
638 </p>
639 </dd>
640 <dt class="hdlist1">
641 --template=&lt;template_directory&gt;
642 </dt>
643 <dd>
645 Specify the directory from which templates will be used;
646 (See the "TEMPLATE DIRECTORY" section of <a href="git-init.html">git-init(1)</a>.)
647 </p>
648 </dd>
649 <dt class="hdlist1">
650 --depth &lt;depth&gt;
651 </dt>
652 <dd>
654 Create a <em>shallow</em> clone with a history truncated to the
655 specified number of revisions. A shallow repository has a
656 number of limitations (you cannot clone or fetch from
657 it, nor push from nor into it), but is adequate if you
658 are only interested in the recent history of a large project
659 with a long history, and would want to send in fixes
660 as patches.
661 </p>
662 </dd>
663 <dt class="hdlist1">
664 --recursive
665 </dt>
666 <dt class="hdlist1">
667 --recurse-submodules
668 </dt>
669 <dd>
671 After the clone is created, initialize all submodules within,
672 using their default settings. This is equivalent to running
673 <tt>git submodule update --init --recursive</tt> immediately after
674 the clone is finished. This option is ignored if the cloned
675 repository does not have a worktree/checkout (i.e. if any of
676 <tt>--no-checkout</tt>/<tt>-n</tt>, <tt>--bare</tt>, or <tt>--mirror</tt> is given)
677 </p>
678 </dd>
679 <dt class="hdlist1">
680 -L=&lt;git dir&gt;
681 </dt>
682 <dt class="hdlist1">
683 --separate-git-dir=&lt;git dir&gt;
684 </dt>
685 <dd>
687 Instead of placing the cloned repository where it is supposed
688 to be, place the cloned repository at the specified directory,
689 then make a filesytem-agnostic git symbolic link to there.
690 The result is git repository can be separated from working
691 tree.
692 </p>
693 </dd>
694 <dt class="hdlist1">
695 &lt;repository&gt;
696 </dt>
697 <dd>
699 The (possibly remote) repository to clone from. See the
700 <a href="#URLS">URLS</a> section below for more information on specifying
701 repositories.
702 </p>
703 </dd>
704 <dt class="hdlist1">
705 &lt;directory&gt;
706 </dt>
707 <dd>
709 The name of a new directory to clone into. The "humanish"
710 part of the source repository is used if no directory is
711 explicitly given (<tt>repo</tt> for <tt>/path/to/repo.git</tt> and <tt>foo</tt>
712 for <tt>host.xz:foo/.git</tt>). Cloning into an existing directory
713 is only allowed if the directory is empty.
714 </p>
715 </dd>
716 </dl></div>
717 </div>
718 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
719 <div class="sectionbody">
720 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
721 address of the remote server, and the path to the repository.
722 Depending on the transport protocol, some of this information may be
723 absent.</p></div>
724 <div class="paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
725 protocols. The following syntaxes may be used with them:</p></div>
726 <div class="ulist"><ul>
727 <li>
729 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
730 </p>
731 </li>
732 <li>
734 git://host.xz&#91;:port&#93;/path/to/repo.git/
735 </p>
736 </li>
737 <li>
739 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
740 </p>
741 </li>
742 <li>
744 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
745 </p>
746 </li>
747 <li>
749 rsync://host.xz/path/to/repo.git/
750 </p>
751 </li>
752 </ul></div>
753 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
754 <div class="ulist"><ul>
755 <li>
757 &#91;user@&#93;host.xz:path/to/repo.git/
758 </p>
759 </li>
760 </ul></div>
761 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
762 <div class="ulist"><ul>
763 <li>
765 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
766 </p>
767 </li>
768 <li>
770 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
771 </p>
772 </li>
773 <li>
775 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
776 </p>
777 </li>
778 </ul></div>
779 <div class="paragraph"><p>For local repositories, also supported by git natively, the following
780 syntaxes may be used:</p></div>
781 <div class="ulist"><ul>
782 <li>
784 /path/to/repo.git/
785 </p>
786 </li>
787 <li>
789 <a href="file:///path/to/repo.git/">file:///path/to/repo.git/</a>
790 </p>
791 </li>
792 </ul></div>
793 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except the former implies
794 --local option.</p></div>
795 <div class="paragraph"><p>When git doesn&#8217;t know how to handle a certain transport protocol, it
796 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
797 exists. To explicitly request a remote helper, the following syntax
798 may be used:</p></div>
799 <div class="ulist"><ul>
800 <li>
802 &lt;transport&gt;::&lt;address&gt;
803 </p>
804 </li>
805 </ul></div>
806 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
807 URL-like string recognized by the specific remote helper being
808 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
809 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
810 you want to use a different format for them (such that the URLs you
811 use will be rewritten into URLs that work), you can create a
812 configuration section of the form:</p></div>
813 <div class="listingblock">
814 <div class="content">
815 <pre><tt> [url "&lt;actual url base&gt;"]
816 insteadOf = &lt;other url base&gt;</tt></pre>
817 </div></div>
818 <div class="paragraph"><p>For example, with this:</p></div>
819 <div class="listingblock">
820 <div class="content">
821 <pre><tt> [url "git://git.host.xz/"]
822 insteadOf = host.xz:/path/to/
823 insteadOf = work:</tt></pre>
824 </div></div>
825 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
826 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
827 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
828 configuration section of the form:</p></div>
829 <div class="listingblock">
830 <div class="content">
831 <pre><tt> [url "&lt;actual url base&gt;"]
832 pushInsteadOf = &lt;other url base&gt;</tt></pre>
833 </div></div>
834 <div class="paragraph"><p>For example, with this:</p></div>
835 <div class="listingblock">
836 <div class="content">
837 <pre><tt> [url "ssh://example.org/"]
838 pushInsteadOf = git://example.org/</tt></pre>
839 </div></div>
840 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
841 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
842 use the original URL.</p></div>
843 </div>
844 <h2 id="_examples">Examples</h2>
845 <div class="sectionbody">
846 <div class="ulist"><ul>
847 <li>
849 Clone from upstream:
850 </p>
851 <div class="listingblock">
852 <div class="content">
853 <pre><tt>$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
854 $ cd my2.6
855 $ make</tt></pre>
856 </div></div>
857 </li>
858 <li>
860 Make a local clone that borrows from the current directory, without checking things out:
861 </p>
862 <div class="listingblock">
863 <div class="content">
864 <pre><tt>$ git clone -l -s -n . ../copy
865 $ cd ../copy
866 $ git show-branch</tt></pre>
867 </div></div>
868 </li>
869 <li>
871 Clone from upstream while borrowing from an existing local directory:
872 </p>
873 <div class="listingblock">
874 <div class="content">
875 <pre><tt>$ git clone --reference my2.6 \
876 git://git.kernel.org/pub/scm/.../linux-2.7 \
877 my2.7
878 $ cd my2.7</tt></pre>
879 </div></div>
880 </li>
881 <li>
883 Create a bare repository to publish your changes to the public:
884 </p>
885 <div class="listingblock">
886 <div class="content">
887 <pre><tt>$ git clone --bare -l /home/proj/.git /pub/scm/proj.git</tt></pre>
888 </div></div>
889 </li>
890 <li>
892 Create a repository on the kernel.org machine that borrows from Linus:
893 </p>
894 <div class="listingblock">
895 <div class="content">
896 <pre><tt>$ git clone --bare -l -s /pub/scm/.../torvalds/linux-2.6.git \
897 /pub/scm/.../me/subsys-2.6.git</tt></pre>
898 </div></div>
899 </li>
900 </ul></div>
901 </div>
902 <h2 id="_git">GIT</h2>
903 <div class="sectionbody">
904 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
905 </div>
906 <div id="footer">
907 <div id="footer-text">
908 Last updated 2011-04-02 04:31:58 UTC
909 </div>
910 </div>
911 </body>
912 </html>