1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
6 <meta http-equiv=
"Content-Type" content=
"application/xhtml+xml; charset=UTF-8" />
7 <meta name=
"generator" content=
"AsciiDoc 10.2.0" />
8 <title>git-clone(
1)
</title>
9 <style type=
"text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.5em;
129 margin-bottom:
1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
228 div.imageblock div.content { padding-left:
0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size:
2em; }
411 span.small { font-size:
0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
443 div.tableblock
> table[
frame=
"hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock
> table[
frame=
"vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
480 border-color: #
527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-top {
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September
2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September
2006. License: GPL */
559 /* modified by Stuart Rackham,
2006,
2009. License: GPL */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([
1-'+(toclevels+
1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType ==
1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute(
"class") || i.getAttribute(
"className")) !=
"float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[
1]-
1);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
610 for (i =
0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute(
"class")
614 && entry.getAttribute(
"class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i =
0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById(
"content"), toclevels);
623 for (var i =
0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id ==
"")
626 entry.element.id =
"_toc_" + i;
627 var a = document.createElement(
"a");
628 a.href =
"#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement(
"div");
632 div.className =
"toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length ==
0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/
2005/
07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
651 var noteholder = document.getElementById(
"footnotes");
655 var entriesToRemove = [];
656 for (i =
0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute(
"class") ==
"footnote")
659 entriesToRemove.push(entry);
661 for (i =
0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById(
"content");
667 var spans = cont.getElementsByTagName(
"span");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-note");
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[
1];
679 "[<a id='_footnoteref_" + n +
"' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n +
"</a>]";
681 spans[i].setAttribute(
"data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n +
"'>" +
685 "<a href='#_footnoteref_" + n +
"' title='Return to text'>" +
686 n +
"</a>. " + note +
"</div>";
687 var id =spans[i].getAttribute(
"id");
688 if (id != null) refs[
"#"+id] = n;
692 noteholder.parentNode.removeChild(noteholder);
694 // Process footnoterefs.
695 for (i=
0; i
<spans.length; i++) {
696 if (spans[i].className ==
"footnoteref") {
697 var href = spans[i].getElementsByTagName(
"a")[
0].getAttribute(
"href");
698 href = href.match(/#.*/)[
0]; // Because IE return full URL.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 git-clone(
1) Manual Page
741 <div class=
"sectionbody">
743 Clone a repository into a new directory
749 <h2 id=
"_synopsis">SYNOPSIS
</h2>
750 <div class=
"sectionbody">
751 <div class=
"verseblock">
752 <pre class=
"content"><em>git clone
</em> [--template=
<template-directory
>]
753 [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
754 [-o
<name
>] [-b
<name
>] [-u
<upload-pack
>] [--reference
<repository
>]
755 [--dissociate] [--separate-git-dir
<git-dir
>]
756 [--depth
<depth
>] [--[no-]single-branch] [--no-tags]
757 [--recurse-submodules[=
<pathspec
>]] [--[no-]shallow-submodules]
758 [--[no-]remote-submodules] [--jobs
<n
>] [--sparse] [--[no-]reject-shallow]
759 [--filter=
<filter
> [--also-filter-submodules]] [--]
<repository
>
760 [
<directory
>]
</pre>
761 <div class=
"attribution">
766 <h2 id=
"_description">DESCRIPTION
</h2>
767 <div class=
"sectionbody">
768 <div class=
"paragraph"><p>Clones a repository into a newly created directory, creates
769 remote-tracking branches for each branch in the cloned repository
770 (visible using
<code>git branch --remotes
</code>), and creates and checks out an
771 initial branch that is forked from the cloned repository
’s
772 currently active branch.
</p></div>
773 <div class=
"paragraph"><p>After the clone, a plain
<code>git fetch
</code> without arguments will update
774 all the remote-tracking branches, and a
<code>git pull
</code> without
775 arguments will in addition merge the remote master branch into the
776 current master branch, if any (this is untrue when
"--single-branch"
777 is given; see below).
</p></div>
778 <div class=
"paragraph"><p>This default configuration is achieved by creating references to
779 the remote branch heads under
<code>refs/remotes/origin
</code> and
780 by initializing
<code>remote.origin.url
</code> and
<code>remote.origin.fetch
</code>
781 configuration variables.
</p></div>
785 <h2 id=
"_options">OPTIONS
</h2>
786 <div class=
"sectionbody">
787 <div class=
"dlist"><dl>
796 When the repository to clone from is on a local machine,
797 this flag bypasses the normal
"Git aware" transport
798 mechanism and clones the repository by making a copy of
799 HEAD and everything under objects and refs directories.
800 The files under
<code>.git/objects/
</code> directory are hardlinked
801 to save space when possible.
803 <div class=
"paragraph"><p>If the repository is specified as a local path (e.g.,
<code>/path/to/repo
</code>),
804 this is the default, and --local is essentially a no-op. If the
805 repository is specified as a URL, then this flag is ignored (and we
806 never use the local optimizations). Specifying
<code>--no-local
</code> will
807 override the default when
<code>/path/to/repo
</code> is given, using the regular
808 Git transport instead.
</p></div>
809 <div class=
"paragraph"><p><strong>NOTE
</strong>: this operation can race with concurrent modification to the
810 source repository, similar to running
<code>cp -r src dst
</code> while modifying
811 <code>src
</code>.
</p></div>
818 Force the cloning process from a repository on a local
819 filesystem to copy the files under the
<code>.git/objects
</code>
820 directory instead of using hardlinks. This may be desirable
821 if you are trying to make a back-up of your repository.
832 When the repository to clone is on the local machine,
833 instead of using hard links, automatically setup
834 <code>.git/objects/info/alternates
</code> to share the objects
835 with the source repository. The resulting repository
836 starts out without any object of its own.
838 <div class=
"paragraph"><p><strong>NOTE
</strong>: this is a possibly dangerous operation; do
<strong>not
</strong> use
839 it unless you understand what it does. If you clone your
840 repository using this option and then delete branches (or use any
841 other Git command that makes any existing commit unreferenced) in the
842 source repository, some objects may become unreferenced (or dangling).
843 These objects may be removed by normal Git operations (such as
<code>git commit
</code>)
844 which automatically call
<code>git maintenance run --auto
</code>. (See
845 <a href=
"git-maintenance.html">git-maintenance(
1)
</a>.) If these objects are removed and were referenced
846 by the cloned repository, then the cloned repository will become corrupt.
</p></div>
847 <div class=
"paragraph"><p>Note that running
<code>git repack
</code> without the
<code>--local
</code> option in a repository
848 cloned with
<code>--shared
</code> will copy objects from the source repository into a pack
849 in the cloned repository, removing the disk space savings of
<code>clone --shared
</code>.
850 It is safe, however, to run
<code>git gc
</code>, which uses the
<code>--local
</code> option by
852 <div class=
"paragraph"><p>If you want to break the dependency of a repository cloned with
<code>--shared
</code> on
853 its source repository, you can simply run
<code>git repack -a
</code> to copy all
854 objects from the source repository into a pack in the cloned repository.
</p></div>
857 --reference[-if-able]
<repository
>
861 If the reference repository is on the local machine,
862 automatically setup
<code>.git/objects/info/alternates
</code> to
863 obtain objects from the reference repository. Using
864 an already existing repository as an alternate will
865 require fewer objects to be copied from the repository
866 being cloned, reducing network and local storage costs.
867 When using the
<code>--reference-if-able
</code>, a non existing
868 directory is skipped with a warning instead of aborting
871 <div class=
"paragraph"><p><strong>NOTE
</strong>: see the NOTE for the
<code>--shared
</code> option, and also the
872 <code>--dissociate
</code> option.
</p></div>
879 Borrow the objects from reference repositories specified
880 with the
<code>--reference
</code> options only to reduce network
881 transfer, and stop borrowing from them after a clone is made
882 by making necessary local copies of borrowed objects. This
883 option can also be used when cloning locally from a
884 repository that already borrows objects from another
885 repository
—the new repository will borrow objects from the
886 same repository, and this option can be used to stop the
898 Operate quietly. Progress is not reported to the standard
910 Run verbosely. Does not affect the reporting of progress status
911 to the standard error stream.
919 Progress status is reported on the standard error stream
920 by default when it is attached to a terminal, unless
<code>--quiet
</code>
921 is specified. This flag forces progress status even if the
922 standard error stream is not directed to a terminal.
926 --server-option=
<option
>
930 Transmit the given string to the server when communicating using
931 protocol version
2. The given string must not contain a NUL or LF
932 character. The server
’s handling of server options, including
933 unknown ones, is server-specific.
934 When multiple
<code>--server-option=
<option
></code> are given, they are all
935 sent to the other side in the order listed on the command line.
946 No checkout of HEAD is performed after the clone is complete.
950 --[no-]reject-shallow
954 Fail if the source repository is a shallow repository.
955 The
<em>clone.rejectShallow
</em> configuration variable can be used to
964 Make a
<em>bare
</em> Git repository. That is, instead of
965 creating
<code><directory
></code> and placing the administrative
966 files in
<code><directory
>/.git
</code>, make the
<code><directory
></code>
967 itself the
<code>$GIT_DIR
</code>. This obviously implies the
<code>--no-checkout
</code>
968 because there is nowhere to check out the working tree.
969 Also the branch heads at the remote are copied directly
970 to corresponding local branch heads, without mapping
971 them to
<code>refs/remotes/origin/
</code>. When this option is
972 used, neither remote-tracking branches nor the related
973 configuration variables are created.
981 Employ a sparse-checkout, with only files in the toplevel
982 directory initially being present. The
983 <a href=
"git-sparse-checkout.html">git-sparse-checkout(
1)
</a> command can be used to grow the
984 working directory as needed.
988 --filter=
<filter-spec
>
992 Use the partial clone feature and request that the server sends
993 a subset of reachable objects according to a given object filter.
994 When using
<code>--filter
</code>, the supplied
<code><filter-spec
></code> is used for
995 the partial clone filter. For example,
<code>--filter=blob:none
</code> will
996 filter out all blobs (file contents) until needed by Git. Also,
997 <code>--filter=blob:limit=
<size
></code> will filter out all blobs of size
998 at least
<code><size
></code>. For more details on filter specifications, see
999 the
<code>--filter
</code> option in
<a href=
"git-rev-list.html">git-rev-list(
1)
</a>.
1002 <dt class=
"hdlist1">
1003 --also-filter-submodules
1007 Also apply the partial clone filter to any submodules in the repository.
1008 Requires
<code>--filter
</code> and
<code>--recurse-submodules
</code>. This can be turned on by
1009 default by setting the
<code>clone.filterSubmodules
</code> config option.
1012 <dt class=
"hdlist1">
1017 Set up a mirror of the source repository. This implies
<code>--bare
</code>.
1018 Compared to
<code>--bare
</code>,
<code>--mirror
</code> not only maps local branches of the
1019 source to local branches of the target, it maps all refs (including
1020 remote-tracking branches, notes etc.) and sets up a refspec configuration such
1021 that all these refs are overwritten by a
<code>git remote update
</code> in the
1025 <dt class=
"hdlist1">
1028 <dt class=
"hdlist1">
1029 --origin
<name
>
1033 Instead of using the remote name
<code>origin
</code> to keep track of the upstream
1034 repository, use
<code><name
></code>. Overrides
<code>clone.defaultRemoteName
</code> from the
1038 <dt class=
"hdlist1">
1041 <dt class=
"hdlist1">
1042 --branch
<name
>
1046 Instead of pointing the newly created HEAD to the branch pointed
1047 to by the cloned repository
’s HEAD, point to
<code><name
></code> branch
1048 instead. In a non-bare repository, this is the branch that will
1050 <code>--branch
</code> can also take tags and detaches the HEAD at that commit
1051 in the resulting repository.
1054 <dt class=
"hdlist1">
1055 -u
<upload-pack
>
1057 <dt class=
"hdlist1">
1058 --upload-pack
<upload-pack
>
1062 When given, and the repository to clone from is accessed
1063 via ssh, this specifies a non-default path for the command
1064 run on the other end.
1067 <dt class=
"hdlist1">
1068 --template=
<template-directory
>
1072 Specify the directory from which templates will be used;
1073 (See the
"TEMPLATE DIRECTORY" section of
<a href=
"git-init.html">git-init(
1)
</a>.)
1076 <dt class=
"hdlist1">
1077 -c
<key
>=
<value
>
1079 <dt class=
"hdlist1">
1080 --config
<key
>=
<value
>
1084 Set a configuration variable in the newly-created repository;
1085 this takes effect immediately after the repository is
1086 initialized, but before the remote history is fetched or any
1087 files checked out. The key is in the same format as expected by
1088 <a href=
"git-config.html">git-config(
1)
</a> (e.g.,
<code>core.eol=true
</code>). If multiple
1089 values are given for the same key, each value will be written to
1090 the config file. This makes it safe, for example, to add
1091 additional fetch refspecs to the origin remote.
1093 <div class=
"paragraph"><p>Due to limitations of the current implementation, some configuration
1094 variables do not take effect until after the initial fetch and checkout.
1095 Configuration variables known to not take effect are:
1096 <code>remote.
<name
>.mirror
</code> and
<code>remote.
<name
>.tagOpt
</code>. Use the
1097 corresponding
<code>--mirror
</code> and
<code>--no-tags
</code> options instead.
</p></div>
1099 <dt class=
"hdlist1">
1100 --depth
<depth
>
1104 Create a
<em>shallow
</em> clone with a history truncated to the
1105 specified number of commits. Implies
<code>--single-branch
</code> unless
1106 <code>--no-single-branch
</code> is given to fetch the histories near the
1107 tips of all branches. If you want to clone submodules shallowly,
1108 also pass
<code>--shallow-submodules
</code>.
1111 <dt class=
"hdlist1">
1112 --shallow-since=
<date
>
1116 Create a shallow clone with a history after the specified time.
1119 <dt class=
"hdlist1">
1120 --shallow-exclude=
<revision
>
1124 Create a shallow clone with a history, excluding commits
1125 reachable from a specified remote branch or tag. This option
1126 can be specified multiple times.
1129 <dt class=
"hdlist1">
1130 --[no-]single-branch
1134 Clone only the history leading to the tip of a single branch,
1135 either specified by the
<code>--branch
</code> option or the primary
1136 branch remote
’s
<code>HEAD
</code> points at.
1137 Further fetches into the resulting repository will only update the
1138 remote-tracking branch for the branch this option was used for the
1139 initial cloning. If the HEAD at the remote did not point at any
1140 branch when
<code>--single-branch
</code> clone was made, no remote-tracking
1144 <dt class=
"hdlist1">
1149 Don
’t clone any tags, and set
1150 <code>remote.
<remote
>.tagOpt=--no-tags
</code> in the config, ensuring
1151 that future
<code>git pull
</code> and
<code>git fetch
</code> operations won
’t follow
1152 any tags. Subsequent explicit tag fetches will still work,
1153 (see
<a href=
"git-fetch.html">git-fetch(
1)
</a>).
1155 <div class=
"paragraph"><p>Can be used in conjunction with
<code>--single-branch
</code> to clone and
1156 maintain a branch with no references other than a single cloned
1157 branch. This is useful e.g. to maintain minimal clones of the default
1158 branch of some repository for search indexing.
</p></div>
1160 <dt class=
"hdlist1">
1161 --recurse-submodules[=
<pathspec
>]
1165 After the clone is created, initialize and clone submodules
1166 within based on the provided pathspec. If no pathspec is
1167 provided, all submodules are initialized and cloned.
1168 This option can be given multiple times for pathspecs consisting
1169 of multiple entries. The resulting clone has
<code>submodule.active
</code> set to
1170 the provided pathspec, or
"." (meaning all submodules) if no
1171 pathspec is provided.
1173 <div class=
"paragraph"><p>Submodules are initialized and cloned using their default settings. This is
1174 equivalent to running
1175 <code>git submodule update --init --recursive
<pathspec
></code> immediately after
1176 the clone is finished. This option is ignored if the cloned repository does
1177 not have a worktree/checkout (i.e. if any of
<code>--no-checkout
</code>/
<code>-n
</code>,
<code>--bare
</code>,
1178 or
<code>--mirror
</code> is given)
</p></div>
1180 <dt class=
"hdlist1">
1181 --[no-]shallow-submodules
1185 All submodules which are cloned will be shallow with a depth of
1.
1188 <dt class=
"hdlist1">
1189 --[no-]remote-submodules
1193 All submodules which are cloned will use the status of the submodule
’s
1194 remote-tracking branch to update the submodule, rather than the
1195 superproject
’s recorded SHA-
1. Equivalent to passing
<code>--remote
</code> to
1196 <code>git submodule update
</code>.
1199 <dt class=
"hdlist1">
1200 --separate-git-dir=
<git-dir
>
1204 Instead of placing the cloned repository where it is supposed
1205 to be, place the cloned repository at the specified directory,
1206 then make a filesystem-agnostic Git symbolic link to there.
1207 The result is Git repository can be separated from working
1211 <dt class=
"hdlist1">
1214 <dt class=
"hdlist1">
1219 The number of submodules fetched at the same time.
1220 Defaults to the
<code>submodule.fetchJobs
</code> option.
1223 <dt class=
"hdlist1">
1228 The (possibly remote) repository to clone from. See the
1229 <a href=
"#URLS">GIT URLS
</a> section below for more information on specifying
1233 <dt class=
"hdlist1">
1238 The name of a new directory to clone into. The
"humanish"
1239 part of the source repository is used if no directory is
1240 explicitly given (
<code>repo
</code> for
<code>/path/to/repo.git
</code> and
<code>foo
</code>
1241 for
<code>host.xz:foo/.git
</code>). Cloning into an existing directory
1242 is only allowed if the directory is empty.
1245 <dt class=
"hdlist1">
1246 --bundle-uri=
<uri
>
1250 Before fetching from the remote, fetch a bundle from the given
1251 <code><uri
></code> and unbundle the data into the local repository. The refs
1252 in the bundle will be stored under the hidden
<code>refs/bundle/*
</code>
1253 namespace. This option is incompatible with
<code>--depth
</code>,
1254 <code>--shallow-since
</code>, and
<code>--shallow-exclude
</code>.
1261 <h2 id=
"_git_urls_a_id_urls_a">GIT URLS
<a id=
"URLS"></a></h2>
1262 <div class=
"sectionbody">
1263 <div class=
"paragraph"><p>In general, URLs contain information about the transport protocol, the
1264 address of the remote server, and the path to the repository.
1265 Depending on the transport protocol, some of this information may be
1267 <div class=
"paragraph"><p>Git supports ssh, git, http, and https protocols (in addition, ftp,
1268 and ftps can be used for fetching, but this is inefficient and
1269 deprecated; do not use it).
</p></div>
1270 <div class=
"paragraph"><p>The native transport (i.e. git:// URL) does no authentication and
1271 should be used with caution on unsecured networks.
</p></div>
1272 <div class=
"paragraph"><p>The following syntaxes may be used with them:
</p></div>
1273 <div class=
"ulist"><ul>
1276 ssh://
[user@
]host.xz
[:port
]/path/to/repo.git/
1281 git://host.xz
[:port
]/path/to/repo.git/
1286 http
[s
]://host.xz
[:port
]/path/to/repo.git/
1291 ftp
[s
]://host.xz
[:port
]/path/to/repo.git/
1295 <div class=
"paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:
</p></div>
1296 <div class=
"ulist"><ul>
1299 [user@
]host.xz:path/to/repo.git/
1303 <div class=
"paragraph"><p>This syntax is only recognized if there are no slashes before the
1304 first colon. This helps differentiate a local path that contains a
1305 colon. For example the local path
<code>foo:bar
</code> could be specified as an
1306 absolute path or
<code>./foo:bar
</code> to avoid being misinterpreted as an ssh
1308 <div class=
"paragraph"><p>The ssh and git protocols additionally support ~username expansion:
</p></div>
1309 <div class=
"ulist"><ul>
1312 ssh://
[user@
]host.xz
[:port
]/~
[user
]/path/to/repo.git/
1317 git://host.xz
[:port
]/~
[user
]/path/to/repo.git/
1322 [user@
]host.xz:/~
[user
]/path/to/repo.git/
1326 <div class=
"paragraph"><p>For local repositories, also supported by Git natively, the following
1327 syntaxes may be used:
</p></div>
1328 <div class=
"ulist"><ul>
1336 file:///path/to/repo.git/
1340 <div class=
"paragraph"><p>These two syntaxes are mostly equivalent, except the former implies
1341 --local option.
</p></div>
1342 <div class=
"paragraph"><p><em>git clone
</em>,
<em>git fetch
</em> and
<em>git pull
</em>, but not
<em>git push
</em>, will also
1343 accept a suitable bundle file. See
<a href=
"git-bundle.html">git-bundle(
1)
</a>.
</p></div>
1344 <div class=
"paragraph"><p>When Git doesn
’t know how to handle a certain transport protocol, it
1345 attempts to use the
<em>remote-
<transport
></em> remote helper, if one
1346 exists. To explicitly request a remote helper, the following syntax
1347 may be used:
</p></div>
1348 <div class=
"ulist"><ul>
1351 <transport
>::
<address
>
1355 <div class=
"paragraph"><p>where
<address
> may be a path, a server and path, or an arbitrary
1356 URL-like string recognized by the specific remote helper being
1357 invoked. See
<a href=
"gitremote-helpers.html">gitremote-helpers(
7)
</a> for details.
</p></div>
1358 <div class=
"paragraph"><p>If there are a large number of similarly-named remote repositories and
1359 you want to use a different format for them (such that the URLs you
1360 use will be rewritten into URLs that work), you can create a
1361 configuration section of the form:
</p></div>
1362 <div class=
"listingblock">
1363 <div class=
"content">
1364 <pre><code> [url
"<actual url base>"]
1365 insteadOf =
<other url base
></code></pre>
1367 <div class=
"paragraph"><p>For example, with this:
</p></div>
1368 <div class=
"listingblock">
1369 <div class=
"content">
1370 <pre><code> [url
"git://git.host.xz/"]
1371 insteadOf = host.xz:/path/to/
1372 insteadOf = work:
</code></pre>
1374 <div class=
"paragraph"><p>a URL like
"work:repo.git" or like
"host.xz:/path/to/repo.git" will be
1375 rewritten in any context that takes a URL to be
"git://git.host.xz/repo.git".
</p></div>
1376 <div class=
"paragraph"><p>If you want to rewrite URLs for push only, you can create a
1377 configuration section of the form:
</p></div>
1378 <div class=
"listingblock">
1379 <div class=
"content">
1380 <pre><code> [url
"<actual url base>"]
1381 pushInsteadOf =
<other url base
></code></pre>
1383 <div class=
"paragraph"><p>For example, with this:
</p></div>
1384 <div class=
"listingblock">
1385 <div class=
"content">
1386 <pre><code> [url
"ssh://example.org/"]
1387 pushInsteadOf = git://example.org/
</code></pre>
1389 <div class=
"paragraph"><p>a URL like
"git://example.org/path/to/repo.git" will be rewritten to
1390 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1391 use the original URL.
</p></div>
1395 <h2 id=
"_examples">EXAMPLES
</h2>
1396 <div class=
"sectionbody">
1397 <div class=
"ulist"><ul>
1400 Clone from upstream:
1402 <div class=
"listingblock">
1403 <div class=
"content">
1404 <pre><code>$ git clone git://git.kernel.org/pub/scm/.../linux.git my-linux
1411 Make a local clone that borrows from the current directory, without checking things out:
1413 <div class=
"listingblock">
1414 <div class=
"content">
1415 <pre><code>$ git clone -l -s -n . ../copy
1417 $ git show-branch
</code></pre>
1422 Clone from upstream while borrowing from an existing local directory:
1424 <div class=
"listingblock">
1425 <div class=
"content">
1426 <pre><code>$ git clone --reference /git/linux.git \
1427 git://git.kernel.org/pub/scm/.../linux.git \
1429 $ cd my-linux
</code></pre>
1434 Create a bare repository to publish your changes to the public:
1436 <div class=
"listingblock">
1437 <div class=
"content">
1438 <pre><code>$ git clone --bare -l /home/proj/.git /pub/scm/proj.git
</code></pre>
1445 <h2 id=
"_configuration">CONFIGURATION
</h2>
1446 <div class=
"sectionbody">
1447 <div class=
"paragraph"><p>Everything below this line in this section is selectively included
1448 from the
<a href=
"git-config.html">git-config(
1)
</a> documentation. The content is the same
1449 as what
’s found there:
</p></div>
1450 <div class=
"dlist"><dl>
1451 <dt class=
"hdlist1">
1456 Specify the directory from which templates will be copied.
1457 (See the
"TEMPLATE DIRECTORY" section of
<a href=
"git-init.html">git-init(
1)
</a>.)
1460 <dt class=
"hdlist1">
1465 Allows overriding the default branch name e.g. when initializing
1469 <dt class=
"hdlist1">
1470 clone.defaultRemoteName
1474 The name of the remote to create when cloning a repository. Defaults to
1475 <code>origin
</code>, and can be overridden by passing the
<code>--origin
</code> command-line
1476 option to
<a href=
"git-clone.html">git-clone(
1)
</a>.
1479 <dt class=
"hdlist1">
1484 Reject to clone a repository if it is a shallow one, can be overridden by
1485 passing option
<code>--reject-shallow
</code> in command line. See
<a href=
"git-clone.html">git-clone(
1)
</a>
1488 <dt class=
"hdlist1">
1489 clone.filterSubmodules
1493 If a partial clone filter is provided (see
<code>--filter
</code> in
1494 <a href=
"git-rev-list.html">git-rev-list(
1)
</a>) and
<code>--recurse-submodules
</code> is used, also apply
1495 the filter to submodules.
1502 <h2 id=
"_git">GIT
</h2>
1503 <div class=
"sectionbody">
1504 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1508 <div id=
"footnotes"><hr /></div>
1510 <div id=
"footer-text">
1512 2022-
09-
15 05:
23:
11 JST