Autogenerated HTML docs for v1.7.6-345-g5c2f8
[git/jnareb-git.git] / git-clone.html
blobdb85d92cc42a3bd40c1582a14dc1f3493c35c1ee
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 &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 --config &lt;key&gt;=&lt;value&gt;
651 </dt>
652 <dt class="hdlist1">
653 -c &lt;key&gt;=&lt;value&gt;
654 </dt>
655 <dd>
657 Set a configuration variable in the newly-created repository;
658 this takes effect immediately after the repository is
659 initialized, but before the remote history is fetched or any
660 files checked out. The key is in the same format as expected by
661 <a href="git-config.html">git-config(1)</a> (e.g., <tt>core.eol=true</tt>). If multiple
662 values are given for the same key, each value will be written to
663 the config file. This makes it safe, for example, to add
664 additional fetch refspecs to the origin remote.
665 </p>
666 </dd>
667 <dt class="hdlist1">
668 --depth &lt;depth&gt;
669 </dt>
670 <dd>
672 Create a <em>shallow</em> clone with a history truncated to the
673 specified number of revisions. A shallow repository has a
674 number of limitations (you cannot clone or fetch from
675 it, nor push from nor into it), but is adequate if you
676 are only interested in the recent history of a large project
677 with a long history, and would want to send in fixes
678 as patches.
679 </p>
680 </dd>
681 <dt class="hdlist1">
682 --recursive
683 </dt>
684 <dt class="hdlist1">
685 --recurse-submodules
686 </dt>
687 <dd>
689 After the clone is created, initialize all submodules within,
690 using their default settings. This is equivalent to running
691 <tt>git submodule update --init --recursive</tt> immediately after
692 the clone is finished. This option is ignored if the cloned
693 repository does not have a worktree/checkout (i.e. if any of
694 <tt>--no-checkout</tt>/<tt>-n</tt>, <tt>--bare</tt>, or <tt>--mirror</tt> is given)
695 </p>
696 </dd>
697 <dt class="hdlist1">
698 --separate-git-dir=&lt;git dir&gt;
699 </dt>
700 <dd>
702 Instead of placing the cloned repository where it is supposed
703 to be, place the cloned repository at the specified directory,
704 then make a filesytem-agnostic git symbolic link to there.
705 The result is git repository can be separated from working
706 tree.
707 </p>
708 </dd>
709 <dt class="hdlist1">
710 &lt;repository&gt;
711 </dt>
712 <dd>
714 The (possibly remote) repository to clone from. See the
715 <a href="#URLS">URLS</a> section below for more information on specifying
716 repositories.
717 </p>
718 </dd>
719 <dt class="hdlist1">
720 &lt;directory&gt;
721 </dt>
722 <dd>
724 The name of a new directory to clone into. The "humanish"
725 part of the source repository is used if no directory is
726 explicitly given (<tt>repo</tt> for <tt>/path/to/repo.git</tt> and <tt>foo</tt>
727 for <tt>host.xz:foo/.git</tt>). Cloning into an existing directory
728 is only allowed if the directory is empty.
729 </p>
730 </dd>
731 </dl></div>
732 </div>
733 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
734 <div class="sectionbody">
735 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
736 address of the remote server, and the path to the repository.
737 Depending on the transport protocol, some of this information may be
738 absent.</p></div>
739 <div class="paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
740 protocols. The following syntaxes may be used with them:</p></div>
741 <div class="ulist"><ul>
742 <li>
744 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
745 </p>
746 </li>
747 <li>
749 git://host.xz&#91;:port&#93;/path/to/repo.git/
750 </p>
751 </li>
752 <li>
754 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
755 </p>
756 </li>
757 <li>
759 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
760 </p>
761 </li>
762 <li>
764 rsync://host.xz/path/to/repo.git/
765 </p>
766 </li>
767 </ul></div>
768 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
769 <div class="ulist"><ul>
770 <li>
772 &#91;user@&#93;host.xz:path/to/repo.git/
773 </p>
774 </li>
775 </ul></div>
776 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
777 <div class="ulist"><ul>
778 <li>
780 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
781 </p>
782 </li>
783 <li>
785 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
786 </p>
787 </li>
788 <li>
790 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
791 </p>
792 </li>
793 </ul></div>
794 <div class="paragraph"><p>For local repositories, also supported by git natively, the following
795 syntaxes may be used:</p></div>
796 <div class="ulist"><ul>
797 <li>
799 /path/to/repo.git/
800 </p>
801 </li>
802 <li>
804 <a href="file:///path/to/repo.git/">file:///path/to/repo.git/</a>
805 </p>
806 </li>
807 </ul></div>
808 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except the former implies
809 --local option.</p></div>
810 <div class="paragraph"><p>When git doesn&#8217;t know how to handle a certain transport protocol, it
811 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
812 exists. To explicitly request a remote helper, the following syntax
813 may be used:</p></div>
814 <div class="ulist"><ul>
815 <li>
817 &lt;transport&gt;::&lt;address&gt;
818 </p>
819 </li>
820 </ul></div>
821 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
822 URL-like string recognized by the specific remote helper being
823 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
824 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
825 you want to use a different format for them (such that the URLs you
826 use will be rewritten into URLs that work), you can create a
827 configuration section of the form:</p></div>
828 <div class="listingblock">
829 <div class="content">
830 <pre><tt> [url "&lt;actual url base&gt;"]
831 insteadOf = &lt;other url base&gt;</tt></pre>
832 </div></div>
833 <div class="paragraph"><p>For example, with this:</p></div>
834 <div class="listingblock">
835 <div class="content">
836 <pre><tt> [url "git://git.host.xz/"]
837 insteadOf = host.xz:/path/to/
838 insteadOf = work:</tt></pre>
839 </div></div>
840 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
841 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
842 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
843 configuration section of the form:</p></div>
844 <div class="listingblock">
845 <div class="content">
846 <pre><tt> [url "&lt;actual url base&gt;"]
847 pushInsteadOf = &lt;other url base&gt;</tt></pre>
848 </div></div>
849 <div class="paragraph"><p>For example, with this:</p></div>
850 <div class="listingblock">
851 <div class="content">
852 <pre><tt> [url "ssh://example.org/"]
853 pushInsteadOf = git://example.org/</tt></pre>
854 </div></div>
855 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
856 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
857 use the original URL.</p></div>
858 </div>
859 <h2 id="_examples">Examples</h2>
860 <div class="sectionbody">
861 <div class="ulist"><ul>
862 <li>
864 Clone from upstream:
865 </p>
866 <div class="listingblock">
867 <div class="content">
868 <pre><tt>$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
869 $ cd my2.6
870 $ make</tt></pre>
871 </div></div>
872 </li>
873 <li>
875 Make a local clone that borrows from the current directory, without checking things out:
876 </p>
877 <div class="listingblock">
878 <div class="content">
879 <pre><tt>$ git clone -l -s -n . ../copy
880 $ cd ../copy
881 $ git show-branch</tt></pre>
882 </div></div>
883 </li>
884 <li>
886 Clone from upstream while borrowing from an existing local directory:
887 </p>
888 <div class="listingblock">
889 <div class="content">
890 <pre><tt>$ git clone --reference my2.6 \
891 git://git.kernel.org/pub/scm/.../linux-2.7 \
892 my2.7
893 $ cd my2.7</tt></pre>
894 </div></div>
895 </li>
896 <li>
898 Create a bare repository to publish your changes to the public:
899 </p>
900 <div class="listingblock">
901 <div class="content">
902 <pre><tt>$ git clone --bare -l /home/proj/.git /pub/scm/proj.git</tt></pre>
903 </div></div>
904 </li>
905 <li>
907 Create a repository on the kernel.org machine that borrows from Linus:
908 </p>
909 <div class="listingblock">
910 <div class="content">
911 <pre><tt>$ git clone --bare -l -s /pub/scm/.../torvalds/linux-2.6.git \
912 /pub/scm/.../me/subsys-2.6.git</tt></pre>
913 </div></div>
914 </li>
915 </ul></div>
916 </div>
917 <h2 id="_git">GIT</h2>
918 <div class="sectionbody">
919 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
920 </div>
921 <div id="footer">
922 <div id="footer-text">
923 Last updated 2011-07-19 20:01:51 UTC
924 </div>
925 </div>
926 </body>
927 </html>