Autogenerated HTML docs for v2.43.0-522-g2a540
[git-htmldocs.git] / git-push.html
blob1aeffea37c7962492c253ec99683004a52156a30
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">
5 <head>
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-push(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.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 {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
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; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
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 {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
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; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
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;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
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 {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: 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;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
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
552 * Version: 0.4
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 */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
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
586 // browsers).
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);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
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");
631 div.appendChild(a);
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.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
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");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!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];
678 spans[i].innerHTML =
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;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
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.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-push(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-push -
743 Update remote refs along with associated objects
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content"><em>git push</em> [--all | --branches | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=&lt;git-receive-pack&gt;]
753 [--repo=&lt;repository&gt;] [-f | --force] [-d | --delete] [--prune] [-q | --quiet] [-v | --verbose]
754 [-u | --set-upstream] [-o &lt;string&gt; | --push-option=&lt;string&gt;]
755 [--[no-]signed|--signed=(true|false|if-asked)]
756 [--force-with-lease[=&lt;refname&gt;[:&lt;expect&gt;]] [--force-if-includes]]
757 [--no-verify] [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]</pre>
758 <div class="attribution">
759 </div></div>
760 </div>
761 </div>
762 <div class="sect1">
763 <h2 id="_description">DESCRIPTION</h2>
764 <div class="sectionbody">
765 <div class="paragraph"><p>Updates remote refs using local refs, while sending objects
766 necessary to complete the given refs.</p></div>
767 <div class="paragraph"><p>You can make interesting things happen to a repository
768 every time you push into it, by setting up <em>hooks</em> there. See
769 documentation for <a href="git-receive-pack.html">git-receive-pack(1)</a>.</p></div>
770 <div class="paragraph"><p>When the command line does not specify where to push with the
771 <code>&lt;repository&gt;</code> argument, <code>branch.*.remote</code> configuration for the
772 current branch is consulted to determine where to push. If the
773 configuration is missing, it defaults to <em>origin</em>.</p></div>
774 <div class="paragraph"><p>When the command line does not specify what to push with <code>&lt;refspec&gt;...</code>
775 arguments or <code>--all</code>, <code>--mirror</code>, <code>--tags</code> options, the command finds
776 the default <code>&lt;refspec&gt;</code> by consulting <code>remote.*.push</code> configuration,
777 and if it is not found, honors <code>push.default</code> configuration to decide
778 what to push (See <a href="git-config.html">git-config(1)</a> for the meaning of <code>push.default</code>).</p></div>
779 <div class="paragraph"><p>When neither the command-line nor the configuration specifies what to
780 push, the default behavior is used, which corresponds to the <code>simple</code>
781 value for <code>push.default</code>: the current branch is pushed to the
782 corresponding upstream branch, but as a safety measure, the push is
783 aborted if the upstream branch does not have the same name as the
784 local one.</p></div>
785 </div>
786 </div>
787 <div class="sect1">
788 <h2 id="_options_a_id_options_a">OPTIONS<a id="OPTIONS"></a></h2>
789 <div class="sectionbody">
790 <div class="dlist"><dl>
791 <dt class="hdlist1">
792 &lt;repository&gt;
793 </dt>
794 <dd>
796 The "remote" repository that is the destination of a push
797 operation. This parameter can be either a URL
798 (see the section <a href="#URLS">GIT URLS</a> below) or the name
799 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
800 </p>
801 </dd>
802 <dt class="hdlist1">
803 &lt;refspec&gt;&#8230;
804 </dt>
805 <dd>
807 Specify what destination ref to update with what source object.
808 The format of a &lt;refspec&gt; parameter is an optional plus
809 <code>+</code>, followed by the source object &lt;src&gt;, followed
810 by a colon <code>:</code>, followed by the destination ref &lt;dst&gt;.
811 </p>
812 <div class="paragraph"><p>The &lt;src&gt; is often the name of the branch you would want to push, but
813 it can be any arbitrary "SHA-1 expression", such as <code>master~4</code> or
814 <code>HEAD</code> (see <a href="gitrevisions.html">gitrevisions(7)</a>).</p></div>
815 <div class="paragraph"><p>The &lt;dst&gt; tells which ref on the remote side is updated with this
816 push. Arbitrary expressions cannot be used here, an actual ref must
817 be named.
818 If <code>git push [&lt;repository&gt;]</code> without any <code>&lt;refspec&gt;</code> argument is set to
819 update some ref at the destination with <code>&lt;src&gt;</code> with
820 <code>remote.&lt;repository&gt;.push</code> configuration variable, <code>:&lt;dst&gt;</code> part can
821 be omitted&#8212;such a push will update a ref that <code>&lt;src&gt;</code> normally updates
822 without any <code>&lt;refspec&gt;</code> on the command line. Otherwise, missing
823 <code>:&lt;dst&gt;</code> means to update the same ref as the <code>&lt;src&gt;</code>.</p></div>
824 <div class="paragraph"><p>If &lt;dst&gt; doesn&#8217;t start with <code>refs/</code> (e.g. <code>refs/heads/master</code>) we will
825 try to infer where in <code>refs/*</code> on the destination &lt;repository&gt; it
826 belongs based on the type of &lt;src&gt; being pushed and whether &lt;dst&gt;
827 is ambiguous.</p></div>
828 <div class="openblock">
829 <div class="content">
830 <div class="ulist"><ul>
831 <li>
833 If &lt;dst&gt; unambiguously refers to a ref on the &lt;repository&gt; remote,
834 then push to that ref.
835 </p>
836 </li>
837 <li>
839 If &lt;src&gt; resolves to a ref starting with refs/heads/ or refs/tags/,
840 then prepend that to &lt;dst&gt;.
841 </p>
842 </li>
843 <li>
845 Other ambiguity resolutions might be added in the future, but for
846 now any other cases will error out with an error indicating what we
847 tried, and depending on the <code>advice.pushUnqualifiedRefname</code>
848 configuration (see <a href="git-config.html">git-config(1)</a>) suggest what refs/
849 namespace you may have wanted to push to.
850 </p>
851 </li>
852 </ul></div>
853 </div></div>
854 <div class="paragraph"><p>The object referenced by &lt;src&gt; is used to update the &lt;dst&gt; reference
855 on the remote side. Whether this is allowed depends on where in
856 <code>refs/*</code> the &lt;dst&gt; reference lives as described in detail below, in
857 those sections "update" means any modifications except deletes, which
858 as noted after the next few sections are treated differently.</p></div>
859 <div class="paragraph"><p>The <code>refs/heads/*</code> namespace will only accept commit objects, and
860 updates only if they can be fast-forwarded.</p></div>
861 <div class="paragraph"><p>The <code>refs/tags/*</code> namespace will accept any kind of object (as
862 commits, trees and blobs can be tagged), and any updates to them will
863 be rejected.</p></div>
864 <div class="paragraph"><p>It&#8217;s possible to push any type of object to any namespace outside of
865 <code>refs/{tags,heads}/*</code>. In the case of tags and commits, these will be
866 treated as if they were the commits inside <code>refs/heads/*</code> for the
867 purposes of whether the update is allowed.</p></div>
868 <div class="paragraph"><p>I.e. a fast-forward of commits and tags outside <code>refs/{tags,heads}/*</code>
869 is allowed, even in cases where what&#8217;s being fast-forwarded is not a
870 commit, but a tag object which happens to point to a new commit which
871 is a fast-forward of the commit the last tag (or commit) it&#8217;s
872 replacing. Replacing a tag with an entirely different tag is also
873 allowed, if it points to the same commit, as well as pushing a peeled
874 tag, i.e. pushing the commit that existing tag object points to, or a
875 new tag object which an existing commit points to.</p></div>
876 <div class="paragraph"><p>Tree and blob objects outside of <code>refs/{tags,heads}/*</code> will be treated
877 the same way as if they were inside <code>refs/tags/*</code>, any update of them
878 will be rejected.</p></div>
879 <div class="paragraph"><p>All of the rules described above about what&#8217;s not allowed as an update
880 can be overridden by adding an the optional leading <code>+</code> to a refspec
881 (or using <code>--force</code> command line option). The only exception to this
882 is that no amount of forcing will make the <code>refs/heads/*</code> namespace
883 accept a non-commit object. Hooks and configuration can also override
884 or amend these rules, see e.g. <code>receive.denyNonFastForwards</code> in
885 <a href="git-config.html">git-config(1)</a> and <code>pre-receive</code> and <code>update</code> in
886 <a href="githooks.html">githooks(5)</a>.</p></div>
887 <div class="paragraph"><p>Pushing an empty &lt;src&gt; allows you to delete the &lt;dst&gt; ref from the
888 remote repository. Deletions are always accepted without a leading <code>+</code>
889 in the refspec (or <code>--force</code>), except when forbidden by configuration
890 or hooks. See <code>receive.denyDeletes</code> in <a href="git-config.html">git-config(1)</a> and
891 <code>pre-receive</code> and <code>update</code> in <a href="githooks.html">githooks(5)</a>.</p></div>
892 <div class="paragraph"><p>The special refspec <code>:</code> (or <code>+:</code> to allow non-fast-forward updates)
893 directs Git to push "matching" branches: for every branch that exists on
894 the local side, the remote side is updated if a branch of the same name
895 already exists on the remote side.</p></div>
896 <div class="paragraph"><p><code>tag &lt;tag&gt;</code> means the same as <code>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</code>.</p></div>
897 </dd>
898 <dt class="hdlist1">
899 --all
900 </dt>
901 <dt class="hdlist1">
902 --branches
903 </dt>
904 <dd>
906 Push all branches (i.e. refs under <code>refs/heads/</code>); cannot be
907 used with other &lt;refspec&gt;.
908 </p>
909 </dd>
910 <dt class="hdlist1">
911 --prune
912 </dt>
913 <dd>
915 Remove remote branches that don&#8217;t have a local counterpart. For example
916 a remote branch <code>tmp</code> will be removed if a local branch with the same
917 name doesn&#8217;t exist any more. This also respects refspecs, e.g.
918 <code>git push --prune remote refs/heads/*:refs/tmp/*</code> would
919 make sure that remote <code>refs/tmp/foo</code> will be removed if <code>refs/heads/foo</code>
920 doesn&#8217;t exist.
921 </p>
922 </dd>
923 <dt class="hdlist1">
924 --mirror
925 </dt>
926 <dd>
928 Instead of naming each ref to push, specifies that all
929 refs under <code>refs/</code> (which includes but is not
930 limited to <code>refs/heads/</code>, <code>refs/remotes/</code>, and <code>refs/tags/</code>)
931 be mirrored to the remote repository. Newly created local
932 refs will be pushed to the remote end, locally updated refs
933 will be force updated on the remote end, and deleted refs
934 will be removed from the remote end. This is the default
935 if the configuration option <code>remote.&lt;remote&gt;.mirror</code> is
936 set.
937 </p>
938 </dd>
939 <dt class="hdlist1">
941 </dt>
942 <dt class="hdlist1">
943 --dry-run
944 </dt>
945 <dd>
947 Do everything except actually send the updates.
948 </p>
949 </dd>
950 <dt class="hdlist1">
951 --porcelain
952 </dt>
953 <dd>
955 Produce machine-readable output. The output status line for each ref
956 will be tab-separated and sent to stdout instead of stderr. The full
957 symbolic names of the refs will be given.
958 </p>
959 </dd>
960 <dt class="hdlist1">
962 </dt>
963 <dt class="hdlist1">
964 --delete
965 </dt>
966 <dd>
968 All listed refs are deleted from the remote repository. This is
969 the same as prefixing all refs with a colon.
970 </p>
971 </dd>
972 <dt class="hdlist1">
973 --tags
974 </dt>
975 <dd>
977 All refs under <code>refs/tags</code> are pushed, in
978 addition to refspecs explicitly listed on the command
979 line.
980 </p>
981 </dd>
982 <dt class="hdlist1">
983 --follow-tags
984 </dt>
985 <dd>
987 Push all the refs that would be pushed without this option,
988 and also push annotated tags in <code>refs/tags</code> that are missing
989 from the remote but are pointing at commit-ish that are
990 reachable from the refs being pushed. This can also be specified
991 with configuration variable <code>push.followTags</code>. For more
992 information, see <code>push.followTags</code> in <a href="git-config.html">git-config(1)</a>.
993 </p>
994 </dd>
995 <dt class="hdlist1">
996 --[no-]signed
997 </dt>
998 <dt class="hdlist1">
999 --signed=(true|false|if-asked)
1000 </dt>
1001 <dd>
1003 GPG-sign the push request to update refs on the receiving
1004 side, to allow it to be checked by the hooks and/or be
1005 logged. If <code>false</code> or <code>--no-signed</code>, no signing will be
1006 attempted. If <code>true</code> or <code>--signed</code>, the push will fail if the
1007 server does not support signed pushes. If set to <code>if-asked</code>,
1008 sign if and only if the server supports signed pushes. The push
1009 will also fail if the actual call to <code>gpg --sign</code> fails. See
1010 <a href="git-receive-pack.html">git-receive-pack(1)</a> for the details on the receiving end.
1011 </p>
1012 </dd>
1013 <dt class="hdlist1">
1014 --[no-]atomic
1015 </dt>
1016 <dd>
1018 Use an atomic transaction on the remote side if available.
1019 Either all refs are updated, or on error, no refs are updated.
1020 If the server does not support atomic pushes the push will fail.
1021 </p>
1022 </dd>
1023 <dt class="hdlist1">
1024 -o &lt;option&gt;
1025 </dt>
1026 <dt class="hdlist1">
1027 --push-option=&lt;option&gt;
1028 </dt>
1029 <dd>
1031 Transmit the given string to the server, which passes them to
1032 the pre-receive as well as the post-receive hook. The given string
1033 must not contain a NUL or LF character.
1034 When multiple <code>--push-option=&lt;option&gt;</code> are given, they are
1035 all sent to the other side in the order listed on the
1036 command line.
1037 When no <code>--push-option=&lt;option&gt;</code> is given from the command
1038 line, the values of configuration variable <code>push.pushOption</code>
1039 are used instead.
1040 </p>
1041 </dd>
1042 <dt class="hdlist1">
1043 --receive-pack=&lt;git-receive-pack&gt;
1044 </dt>
1045 <dt class="hdlist1">
1046 --exec=&lt;git-receive-pack&gt;
1047 </dt>
1048 <dd>
1050 Path to the <em>git-receive-pack</em> program on the remote
1051 end. Sometimes useful when pushing to a remote
1052 repository over ssh, and you do not have the program in
1053 a directory on the default $PATH.
1054 </p>
1055 </dd>
1056 <dt class="hdlist1">
1057 --[no-]force-with-lease
1058 </dt>
1059 <dt class="hdlist1">
1060 --force-with-lease=&lt;refname&gt;
1061 </dt>
1062 <dt class="hdlist1">
1063 --force-with-lease=&lt;refname&gt;:&lt;expect&gt;
1064 </dt>
1065 <dd>
1067 Usually, "git push" refuses to update a remote ref that is
1068 not an ancestor of the local ref used to overwrite it.
1069 </p>
1070 <div class="paragraph"><p>This option overrides this restriction if the current value of the
1071 remote ref is the expected value. "git push" fails otherwise.</p></div>
1072 <div class="paragraph"><p>Imagine that you have to rebase what you have already published.
1073 You will have to bypass the "must fast-forward" rule in order to
1074 replace the history you originally published with the rebased history.
1075 If somebody else built on top of your original history while you are
1076 rebasing, the tip of the branch at the remote may advance with their
1077 commit, and blindly pushing with <code>--force</code> will lose their work.</p></div>
1078 <div class="paragraph"><p>This option allows you to say that you expect the history you are
1079 updating is what you rebased and want to replace. If the remote ref
1080 still points at the commit you specified, you can be sure that no
1081 other people did anything to the ref. It is like taking a "lease" on
1082 the ref without explicitly locking it, and the remote ref is updated
1083 only if the "lease" is still valid.</p></div>
1084 <div class="paragraph"><p><code>--force-with-lease</code> alone, without specifying the details, will protect
1085 all remote refs that are going to be updated by requiring their
1086 current value to be the same as the remote-tracking branch we have
1087 for them.</p></div>
1088 <div class="paragraph"><p><code>--force-with-lease=&lt;refname&gt;</code>, without specifying the expected value, will
1089 protect the named ref (alone), if it is going to be updated, by
1090 requiring its current value to be the same as the remote-tracking
1091 branch we have for it.</p></div>
1092 <div class="paragraph"><p><code>--force-with-lease=&lt;refname&gt;:&lt;expect&gt;</code> will protect the named ref (alone),
1093 if it is going to be updated, by requiring its current value to be
1094 the same as the specified value <code>&lt;expect&gt;</code> (which is allowed to be
1095 different from the remote-tracking branch we have for the refname,
1096 or we do not even have to have such a remote-tracking branch when
1097 this form is used). If <code>&lt;expect&gt;</code> is the empty string, then the named ref
1098 must not already exist.</p></div>
1099 <div class="paragraph"><p>Note that all forms other than <code>--force-with-lease=&lt;refname&gt;:&lt;expect&gt;</code>
1100 that specifies the expected current value of the ref explicitly are
1101 still experimental and their semantics may change as we gain experience
1102 with this feature.</p></div>
1103 <div class="paragraph"><p>"--no-force-with-lease" will cancel all the previous --force-with-lease on the
1104 command line.</p></div>
1105 <div class="paragraph"><p>A general note on safety: supplying this option without an expected
1106 value, i.e. as <code>--force-with-lease</code> or <code>--force-with-lease=&lt;refname&gt;</code>
1107 interacts very badly with anything that implicitly runs <code>git fetch</code> on
1108 the remote to be pushed to in the background, e.g. <code>git fetch origin</code>
1109 on your repository in a cronjob.</p></div>
1110 <div class="paragraph"><p>The protection it offers over <code>--force</code> is ensuring that subsequent
1111 changes your work wasn&#8217;t based on aren&#8217;t clobbered, but this is
1112 trivially defeated if some background process is updating refs in the
1113 background. We don&#8217;t have anything except the remote tracking info to
1114 go by as a heuristic for refs you&#8217;re expected to have seen &amp; are
1115 willing to clobber.</p></div>
1116 <div class="paragraph"><p>If your editor or some other system is running <code>git fetch</code> in the
1117 background for you a way to mitigate this is to simply set up another
1118 remote:</p></div>
1119 <div class="literalblock">
1120 <div class="content">
1121 <pre><code>git remote add origin-push $(git config remote.origin.url)
1122 git fetch origin-push</code></pre>
1123 </div></div>
1124 <div class="paragraph"><p>Now when the background process runs <code>git fetch origin</code> the references
1125 on <code>origin-push</code> won&#8217;t be updated, and thus commands like:</p></div>
1126 <div class="literalblock">
1127 <div class="content">
1128 <pre><code>git push --force-with-lease origin-push</code></pre>
1129 </div></div>
1130 <div class="paragraph"><p>Will fail unless you manually run <code>git fetch origin-push</code>. This method
1131 is of course entirely defeated by something that runs <code>git fetch
1132 --all</code>, in that case you&#8217;d need to either disable it or do something
1133 more tedious like:</p></div>
1134 <div class="literalblock">
1135 <div class="content">
1136 <pre><code>git fetch # update 'master' from remote
1137 git tag base master # mark our base point
1138 git rebase -i master # rewrite some commits
1139 git push --force-with-lease=master:base master:master</code></pre>
1140 </div></div>
1141 <div class="paragraph"><p>I.e. create a <code>base</code> tag for versions of the upstream code that you&#8217;ve
1142 seen and are willing to overwrite, then rewrite history, and finally
1143 force push changes to <code>master</code> if the remote version is still at
1144 <code>base</code>, regardless of what your local <code>remotes/origin/master</code> has been
1145 updated to in the background.</p></div>
1146 <div class="paragraph"><p>Alternatively, specifying <code>--force-if-includes</code> as an ancillary option
1147 along with <code>--force-with-lease[=&lt;refname&gt;]</code> (i.e., without saying what
1148 exact commit the ref on the remote side must be pointing at, or which
1149 refs on the remote side are being protected) at the time of "push" will
1150 verify if updates from the remote-tracking refs that may have been
1151 implicitly updated in the background are integrated locally before
1152 allowing a forced update.</p></div>
1153 </dd>
1154 <dt class="hdlist1">
1156 </dt>
1157 <dt class="hdlist1">
1158 --force
1159 </dt>
1160 <dd>
1162 Usually, the command refuses to update a remote ref that is
1163 not an ancestor of the local ref used to overwrite it.
1164 Also, when <code>--force-with-lease</code> option is used, the command refuses
1165 to update a remote ref whose current value does not match
1166 what is expected.
1167 </p>
1168 <div class="paragraph"><p>This flag disables these checks, and can cause the remote repository
1169 to lose commits; use it with care.</p></div>
1170 <div class="paragraph"><p>Note that <code>--force</code> applies to all the refs that are pushed, hence
1171 using it with <code>push.default</code> set to <code>matching</code> or with multiple push
1172 destinations configured with <code>remote.*.push</code> may overwrite refs
1173 other than the current branch (including local refs that are
1174 strictly behind their remote counterpart). To force a push to only
1175 one branch, use a <code>+</code> in front of the refspec to push (e.g <code>git push
1176 origin +master</code> to force a push to the <code>master</code> branch). See the
1177 <code>&lt;refspec&gt;...</code> section above for details.</p></div>
1178 </dd>
1179 <dt class="hdlist1">
1180 --[no-]force-if-includes
1181 </dt>
1182 <dd>
1184 Force an update only if the tip of the remote-tracking ref
1185 has been integrated locally.
1186 </p>
1187 <div class="paragraph"><p>This option enables a check that verifies if the tip of the
1188 remote-tracking ref is reachable from one of the "reflog" entries of
1189 the local branch based in it for a rewrite. The check ensures that any
1190 updates from the remote have been incorporated locally by rejecting the
1191 forced update if that is not the case.</p></div>
1192 <div class="paragraph"><p>If the option is passed without specifying <code>--force-with-lease</code>, or
1193 specified along with <code>--force-with-lease=&lt;refname&gt;:&lt;expect&gt;</code>, it is
1194 a "no-op".</p></div>
1195 <div class="paragraph"><p>Specifying <code>--no-force-if-includes</code> disables this behavior.</p></div>
1196 </dd>
1197 <dt class="hdlist1">
1198 --repo=&lt;repository&gt;
1199 </dt>
1200 <dd>
1202 This option is equivalent to the &lt;repository&gt; argument. If both
1203 are specified, the command-line argument takes precedence.
1204 </p>
1205 </dd>
1206 <dt class="hdlist1">
1208 </dt>
1209 <dt class="hdlist1">
1210 --set-upstream
1211 </dt>
1212 <dd>
1214 For every branch that is up to date or successfully pushed, add
1215 upstream (tracking) reference, used by argument-less
1216 <a href="git-pull.html">git-pull(1)</a> and other commands. For more information,
1217 see <code>branch.&lt;name&gt;.merge</code> in <a href="git-config.html">git-config(1)</a>.
1218 </p>
1219 </dd>
1220 <dt class="hdlist1">
1221 --[no-]thin
1222 </dt>
1223 <dd>
1225 These options are passed to <a href="git-send-pack.html">git-send-pack(1)</a>. A thin transfer
1226 significantly reduces the amount of sent data when the sender and
1227 receiver share many of the same objects in common. The default is
1228 <code>--thin</code>.
1229 </p>
1230 </dd>
1231 <dt class="hdlist1">
1233 </dt>
1234 <dt class="hdlist1">
1235 --quiet
1236 </dt>
1237 <dd>
1239 Suppress all output, including the listing of updated refs,
1240 unless an error occurs. Progress is not reported to the standard
1241 error stream.
1242 </p>
1243 </dd>
1244 <dt class="hdlist1">
1246 </dt>
1247 <dt class="hdlist1">
1248 --verbose
1249 </dt>
1250 <dd>
1252 Run verbosely.
1253 </p>
1254 </dd>
1255 <dt class="hdlist1">
1256 --progress
1257 </dt>
1258 <dd>
1260 Progress status is reported on the standard error stream
1261 by default when it is attached to a terminal, unless -q
1262 is specified. This flag forces progress status even if the
1263 standard error stream is not directed to a terminal.
1264 </p>
1265 </dd>
1266 <dt class="hdlist1">
1267 --no-recurse-submodules
1268 </dt>
1269 <dt class="hdlist1">
1270 --recurse-submodules=check|on-demand|only|no
1271 </dt>
1272 <dd>
1274 May be used to make sure all submodule commits used by the
1275 revisions to be pushed are available on a remote-tracking branch.
1276 If <em>check</em> is used Git will verify that all submodule commits that
1277 changed in the revisions to be pushed are available on at least one
1278 remote of the submodule. If any commits are missing the push will
1279 be aborted and exit with non-zero status. If <em>on-demand</em> is used
1280 all submodules that changed in the revisions to be pushed will be
1281 pushed. If on-demand was not able to push all necessary revisions it will
1282 also be aborted and exit with non-zero status. If <em>only</em> is used all
1283 submodules will be pushed while the superproject is left
1284 unpushed. A value of <em>no</em> or using <code>--no-recurse-submodules</code> can be used
1285 to override the push.recurseSubmodules configuration variable when no
1286 submodule recursion is required.
1287 </p>
1288 <div class="paragraph"><p>When using <em>on-demand</em> or <em>only</em>, if a submodule has a
1289 "push.recurseSubmodules={on-demand,only}" or "submodule.recurse" configuration,
1290 further recursion will occur. In this case, "only" is treated as "on-demand".</p></div>
1291 </dd>
1292 <dt class="hdlist1">
1293 --[no-]verify
1294 </dt>
1295 <dd>
1297 Toggle the pre-push hook (see <a href="githooks.html">githooks(5)</a>). The
1298 default is --verify, giving the hook a chance to prevent the
1299 push. With --no-verify, the hook is bypassed completely.
1300 </p>
1301 </dd>
1302 <dt class="hdlist1">
1304 </dt>
1305 <dt class="hdlist1">
1306 --ipv4
1307 </dt>
1308 <dd>
1310 Use IPv4 addresses only, ignoring IPv6 addresses.
1311 </p>
1312 </dd>
1313 <dt class="hdlist1">
1315 </dt>
1316 <dt class="hdlist1">
1317 --ipv6
1318 </dt>
1319 <dd>
1321 Use IPv6 addresses only, ignoring IPv4 addresses.
1322 </p>
1323 </dd>
1324 </dl></div>
1325 </div>
1326 </div>
1327 <div class="sect1">
1328 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
1329 <div class="sectionbody">
1330 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
1331 address of the remote server, and the path to the repository.
1332 Depending on the transport protocol, some of this information may be
1333 absent.</p></div>
1334 <div class="paragraph"><p>Git supports ssh, git, http, and https protocols (in addition, ftp
1335 and ftps can be used for fetching, but this is inefficient and
1336 deprecated; do not use them).</p></div>
1337 <div class="paragraph"><p>The native transport (i.e. git:// URL) does no authentication and
1338 should be used with caution on unsecured networks.</p></div>
1339 <div class="paragraph"><p>The following syntaxes may be used with them:</p></div>
1340 <div class="ulist"><ul>
1341 <li>
1343 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
1344 </p>
1345 </li>
1346 <li>
1348 git://host.xz&#91;:port&#93;/path/to/repo.git/
1349 </p>
1350 </li>
1351 <li>
1353 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
1354 </p>
1355 </li>
1356 <li>
1358 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
1359 </p>
1360 </li>
1361 </ul></div>
1362 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
1363 <div class="ulist"><ul>
1364 <li>
1366 &#91;user@&#93;host.xz:path/to/repo.git/
1367 </p>
1368 </li>
1369 </ul></div>
1370 <div class="paragraph"><p>This syntax is only recognized if there are no slashes before the
1371 first colon. This helps differentiate a local path that contains a
1372 colon. For example the local path <code>foo:bar</code> could be specified as an
1373 absolute path or <code>./foo:bar</code> to avoid being misinterpreted as an ssh
1374 url.</p></div>
1375 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
1376 <div class="ulist"><ul>
1377 <li>
1379 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
1380 </p>
1381 </li>
1382 <li>
1384 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
1385 </p>
1386 </li>
1387 <li>
1389 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
1390 </p>
1391 </li>
1392 </ul></div>
1393 <div class="paragraph"><p>For local repositories, also supported by Git natively, the following
1394 syntaxes may be used:</p></div>
1395 <div class="ulist"><ul>
1396 <li>
1398 /path/to/repo.git/
1399 </p>
1400 </li>
1401 <li>
1403 file:///path/to/repo.git/
1404 </p>
1405 </li>
1406 </ul></div>
1407 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
1408 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
1409 details.</p></div>
1410 <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
1411 accept a suitable bundle file. See <a href="git-bundle.html">git-bundle(1)</a>.</p></div>
1412 <div class="paragraph"><p>When Git doesn&#8217;t know how to handle a certain transport protocol, it
1413 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
1414 exists. To explicitly request a remote helper, the following syntax
1415 may be used:</p></div>
1416 <div class="ulist"><ul>
1417 <li>
1419 &lt;transport&gt;::&lt;address&gt;
1420 </p>
1421 </li>
1422 </ul></div>
1423 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
1424 URL-like string recognized by the specific remote helper being
1425 invoked. See <a href="gitremote-helpers.html">gitremote-helpers(7)</a> for details.</p></div>
1426 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
1427 you want to use a different format for them (such that the URLs you
1428 use will be rewritten into URLs that work), you can create a
1429 configuration section of the form:</p></div>
1430 <div class="listingblock">
1431 <div class="content">
1432 <pre><code> [url "&lt;actual url base&gt;"]
1433 insteadOf = &lt;other url base&gt;</code></pre>
1434 </div></div>
1435 <div class="paragraph"><p>For example, with this:</p></div>
1436 <div class="listingblock">
1437 <div class="content">
1438 <pre><code> [url "git://git.host.xz/"]
1439 insteadOf = host.xz:/path/to/
1440 insteadOf = work:</code></pre>
1441 </div></div>
1442 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
1443 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
1444 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
1445 configuration section of the form:</p></div>
1446 <div class="listingblock">
1447 <div class="content">
1448 <pre><code> [url "&lt;actual url base&gt;"]
1449 pushInsteadOf = &lt;other url base&gt;</code></pre>
1450 </div></div>
1451 <div class="paragraph"><p>For example, with this:</p></div>
1452 <div class="listingblock">
1453 <div class="content">
1454 <pre><code> [url "ssh://example.org/"]
1455 pushInsteadOf = git://example.org/</code></pre>
1456 </div></div>
1457 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
1458 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1459 use the original URL.</p></div>
1460 </div>
1461 </div>
1462 <div class="sect1">
1463 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
1464 <div class="sectionbody">
1465 <div class="paragraph"><p>The name of one of the following can be used instead
1466 of a URL as <code>&lt;repository&gt;</code> argument:</p></div>
1467 <div class="ulist"><ul>
1468 <li>
1470 a remote in the Git configuration file: <code>$GIT_DIR/config</code>,
1471 </p>
1472 </li>
1473 <li>
1475 a file in the <code>$GIT_DIR/remotes</code> directory, or
1476 </p>
1477 </li>
1478 <li>
1480 a file in the <code>$GIT_DIR/branches</code> directory.
1481 </p>
1482 </li>
1483 </ul></div>
1484 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
1485 because they each contain a refspec which git will use by default.</p></div>
1486 <div class="sect2">
1487 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3>
1488 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
1489 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
1490 or even by a manual edit to the <code>$GIT_DIR/config</code> file. The URL of
1491 this remote will be used to access the repository. The refspec
1492 of this remote will be used by default when you do
1493 not provide a refspec on the command line. The entry in the
1494 config file would appear like this:</p></div>
1495 <div class="listingblock">
1496 <div class="content">
1497 <pre><code> [remote "&lt;name&gt;"]
1498 url = &lt;URL&gt;
1499 pushurl = &lt;pushurl&gt;
1500 push = &lt;refspec&gt;
1501 fetch = &lt;refspec&gt;</code></pre>
1502 </div></div>
1503 <div class="paragraph"><p>The <code>&lt;pushurl&gt;</code> is used for pushes only. It is optional and defaults
1504 to <code>&lt;URL&gt;</code>. Pushing to a remote affects all defined pushurls or all
1505 defined urls if no pushurls are defined. Fetch, however, will only
1506 fetch from the first defined url if multiple urls are defined.</p></div>
1507 </div>
1508 <div class="sect2">
1509 <h3 id="_named_file_in_code_git_dir_remotes_code">Named file in <code>$GIT_DIR/remotes</code></h3>
1510 <div class="paragraph"><p>You can choose to provide the name of a
1511 file in <code>$GIT_DIR/remotes</code>. The URL
1512 in this file will be used to access the repository. The refspec
1513 in this file will be used as default when you do not
1514 provide a refspec on the command line. This file should have the
1515 following format:</p></div>
1516 <div class="listingblock">
1517 <div class="content">
1518 <pre><code> URL: one of the above URL formats
1519 Push: &lt;refspec&gt;
1520 Pull: &lt;refspec&gt;</code></pre>
1521 </div></div>
1522 <div class="paragraph"><p><code>Push:</code> lines are used by <em>git push</em> and
1523 <code>Pull:</code> lines are used by <em>git pull</em> and <em>git fetch</em>.
1524 Multiple <code>Push:</code> and <code>Pull:</code> lines may
1525 be specified for additional branch mappings.</p></div>
1526 </div>
1527 <div class="sect2">
1528 <h3 id="_named_file_in_code_git_dir_branches_code">Named file in <code>$GIT_DIR/branches</code></h3>
1529 <div class="paragraph"><p>You can choose to provide the name of a
1530 file in <code>$GIT_DIR/branches</code>.
1531 The URL in this file will be used to access the repository.
1532 This file should have the following format:</p></div>
1533 <div class="listingblock">
1534 <div class="content">
1535 <pre><code> &lt;URL&gt;#&lt;head&gt;</code></pre>
1536 </div></div>
1537 <div class="paragraph"><p><code>&lt;URL&gt;</code> is required; <code>#&lt;head&gt;</code> is optional.</p></div>
1538 <div class="paragraph"><p>Depending on the operation, git will use one of the following
1539 refspecs, if you don&#8217;t provide one on the command line.
1540 <code>&lt;branch&gt;</code> is the name of this file in <code>$GIT_DIR/branches</code> and
1541 <code>&lt;head&gt;</code> defaults to <code>master</code>.</p></div>
1542 <div class="paragraph"><p>git fetch uses:</p></div>
1543 <div class="listingblock">
1544 <div class="content">
1545 <pre><code> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</code></pre>
1546 </div></div>
1547 <div class="paragraph"><p>git push uses:</p></div>
1548 <div class="listingblock">
1549 <div class="content">
1550 <pre><code> HEAD:refs/heads/&lt;head&gt;</code></pre>
1551 </div></div>
1552 </div>
1553 </div>
1554 </div>
1555 <div class="sect1">
1556 <h2 id="_output">OUTPUT</h2>
1557 <div class="sectionbody">
1558 <div class="paragraph"><p>The output of "git push" depends on the transport method used; this
1559 section describes the output when pushing over the Git protocol (either
1560 locally or via ssh).</p></div>
1561 <div class="paragraph"><p>The status of the push is output in tabular form, with each line
1562 representing the status of a single ref. Each line is of the form:</p></div>
1563 <div class="listingblock">
1564 <div class="content">
1565 <pre><code> &lt;flag&gt; &lt;summary&gt; &lt;from&gt; -&gt; &lt;to&gt; (&lt;reason&gt;)</code></pre>
1566 </div></div>
1567 <div class="paragraph"><p>If --porcelain is used, then each line of the output is of the form:</p></div>
1568 <div class="listingblock">
1569 <div class="content">
1570 <pre><code> &lt;flag&gt; \t &lt;from&gt;:&lt;to&gt; \t &lt;summary&gt; (&lt;reason&gt;)</code></pre>
1571 </div></div>
1572 <div class="paragraph"><p>The status of up-to-date refs is shown only if --porcelain or --verbose
1573 option is used.</p></div>
1574 <div class="dlist"><dl>
1575 <dt class="hdlist1">
1576 flag
1577 </dt>
1578 <dd>
1580 A single character indicating the status of the ref:
1581 </p>
1582 <div class="dlist"><dl>
1583 <dt class="hdlist1">
1584 (space)
1585 </dt>
1586 <dd>
1588 for a successfully pushed fast-forward;
1589 </p>
1590 </dd>
1591 <dt class="hdlist1">
1592 <code>+</code>
1593 </dt>
1594 <dd>
1596 for a successful forced update;
1597 </p>
1598 </dd>
1599 <dt class="hdlist1">
1600 <code>-</code>
1601 </dt>
1602 <dd>
1604 for a successfully deleted ref;
1605 </p>
1606 </dd>
1607 <dt class="hdlist1">
1608 <code>*</code>
1609 </dt>
1610 <dd>
1612 for a successfully pushed new ref;
1613 </p>
1614 </dd>
1615 <dt class="hdlist1">
1616 <code>!</code>
1617 </dt>
1618 <dd>
1620 for a ref that was rejected or failed to push; and
1621 </p>
1622 </dd>
1623 <dt class="hdlist1">
1624 <code>=</code>
1625 </dt>
1626 <dd>
1628 for a ref that was up to date and did not need pushing.
1629 </p>
1630 </dd>
1631 </dl></div>
1632 </dd>
1633 <dt class="hdlist1">
1634 summary
1635 </dt>
1636 <dd>
1638 For a successfully pushed ref, the summary shows the old and new
1639 values of the ref in a form suitable for using as an argument to
1640 <code>git log</code> (this is <code>&lt;old&gt;..&lt;new&gt;</code> in most cases, and
1641 <code>&lt;old&gt;...&lt;new&gt;</code> for forced non-fast-forward updates).
1642 </p>
1643 <div class="paragraph"><p>For a failed update, more details are given:</p></div>
1644 <div class="openblock">
1645 <div class="content">
1646 <div class="dlist"><dl>
1647 <dt class="hdlist1">
1648 rejected
1649 </dt>
1650 <dd>
1652 Git did not try to send the ref at all, typically because it
1653 is not a fast-forward and you did not force the update.
1654 </p>
1655 </dd>
1656 <dt class="hdlist1">
1657 remote rejected
1658 </dt>
1659 <dd>
1661 The remote end refused the update. Usually caused by a hook
1662 on the remote side, or because the remote repository has one
1663 of the following safety options in effect:
1664 <code>receive.denyCurrentBranch</code> (for pushes to the checked out
1665 branch), <code>receive.denyNonFastForwards</code> (for forced
1666 non-fast-forward updates), <code>receive.denyDeletes</code> or
1667 <code>receive.denyDeleteCurrent</code>. See <a href="git-config.html">git-config(1)</a>.
1668 </p>
1669 </dd>
1670 <dt class="hdlist1">
1671 remote failure
1672 </dt>
1673 <dd>
1675 The remote end did not report the successful update of the ref,
1676 perhaps because of a temporary error on the remote side, a
1677 break in the network connection, or other transient error.
1678 </p>
1679 </dd>
1680 </dl></div>
1681 </div></div>
1682 </dd>
1683 <dt class="hdlist1">
1684 from
1685 </dt>
1686 <dd>
1688 The name of the local ref being pushed, minus its
1689 <code>refs/&lt;type&gt;/</code> prefix. In the case of deletion, the
1690 name of the local ref is omitted.
1691 </p>
1692 </dd>
1693 <dt class="hdlist1">
1695 </dt>
1696 <dd>
1698 The name of the remote ref being updated, minus its
1699 <code>refs/&lt;type&gt;/</code> prefix.
1700 </p>
1701 </dd>
1702 <dt class="hdlist1">
1703 reason
1704 </dt>
1705 <dd>
1707 A human-readable explanation. In the case of successfully pushed
1708 refs, no explanation is needed. For a failed ref, the reason for
1709 failure is described.
1710 </p>
1711 </dd>
1712 </dl></div>
1713 </div>
1714 </div>
1715 <div class="sect1">
1716 <h2 id="_note_about_fast_forwards">NOTE ABOUT FAST-FORWARDS</h2>
1717 <div class="sectionbody">
1718 <div class="paragraph"><p>When an update changes a branch (or more in general, a ref) that used to
1719 point at commit A to point at another commit B, it is called a
1720 fast-forward update if and only if B is a descendant of A.</p></div>
1721 <div class="paragraph"><p>In a fast-forward update from A to B, the set of commits that the original
1722 commit A built on top of is a subset of the commits the new commit B
1723 builds on top of. Hence, it does not lose any history.</p></div>
1724 <div class="paragraph"><p>In contrast, a non-fast-forward update will lose history. For example,
1725 suppose you and somebody else started at the same commit X, and you built
1726 a history leading to commit B while the other person built a history
1727 leading to commit A. The history looks like this:</p></div>
1728 <div class="listingblock">
1729 <div class="content">
1730 <pre><code> B
1732 ---X---A</code></pre>
1733 </div></div>
1734 <div class="paragraph"><p>Further suppose that the other person already pushed changes leading to A
1735 back to the original repository from which you two obtained the original
1736 commit X.</p></div>
1737 <div class="paragraph"><p>The push done by the other person updated the branch that used to point at
1738 commit X to point at commit A. It is a fast-forward.</p></div>
1739 <div class="paragraph"><p>But if you try to push, you will attempt to update the branch (that
1740 now points at A) with commit B. This does <em>not</em> fast-forward. If you did
1741 so, the changes introduced by commit A will be lost, because everybody
1742 will now start building on top of B.</p></div>
1743 <div class="paragraph"><p>The command by default does not allow an update that is not a fast-forward
1744 to prevent such loss of history.</p></div>
1745 <div class="paragraph"><p>If you do not want to lose your work (history from X to B) or the work by
1746 the other person (history from X to A), you would need to first fetch the
1747 history from the repository, create a history that contains changes done
1748 by both parties, and push the result back.</p></div>
1749 <div class="paragraph"><p>You can perform "git pull", resolve potential conflicts, and "git push"
1750 the result. A "git pull" will create a merge commit C between commits A
1751 and B.</p></div>
1752 <div class="listingblock">
1753 <div class="content">
1754 <pre><code> B---C
1756 ---X---A</code></pre>
1757 </div></div>
1758 <div class="paragraph"><p>Updating A with the resulting merge commit will fast-forward and your
1759 push will be accepted.</p></div>
1760 <div class="paragraph"><p>Alternatively, you can rebase your change between X and B on top of A,
1761 with "git pull --rebase", and push the result back. The rebase will
1762 create a new commit D that builds the change between X and B on top of
1763 A.</p></div>
1764 <div class="listingblock">
1765 <div class="content">
1766 <pre><code> B D
1768 ---X---A</code></pre>
1769 </div></div>
1770 <div class="paragraph"><p>Again, updating A with this commit will fast-forward and your push will be
1771 accepted.</p></div>
1772 <div class="paragraph"><p>There is another common situation where you may encounter non-fast-forward
1773 rejection when you try to push, and it is possible even when you are
1774 pushing into a repository nobody else pushes into. After you push commit
1775 A yourself (in the first picture in this section), replace it with "git
1776 commit --amend" to produce commit B, and you try to push it out, because
1777 forgot that you have pushed A out already. In such a case, and only if
1778 you are certain that nobody in the meantime fetched your earlier commit A
1779 (and started building on top of it), you can run "git push --force" to
1780 overwrite it. In other words, "git push --force" is a method reserved for
1781 a case where you do mean to lose history.</p></div>
1782 </div>
1783 </div>
1784 <div class="sect1">
1785 <h2 id="_examples">EXAMPLES</h2>
1786 <div class="sectionbody">
1787 <div class="dlist"><dl>
1788 <dt class="hdlist1">
1789 <code>git push</code>
1790 </dt>
1791 <dd>
1793 Works like <code>git push &lt;remote&gt;</code>, where &lt;remote&gt; is the
1794 current branch&#8217;s remote (or <code>origin</code>, if no remote is
1795 configured for the current branch).
1796 </p>
1797 </dd>
1798 <dt class="hdlist1">
1799 <code>git push origin</code>
1800 </dt>
1801 <dd>
1803 Without additional configuration, pushes the current branch to
1804 the configured upstream (<code>branch.&lt;name&gt;.merge</code> configuration
1805 variable) if it has the same name as the current branch, and
1806 errors out without pushing otherwise.
1807 </p>
1808 <div class="paragraph"><p>The default behavior of this command when no &lt;refspec&gt; is given can be
1809 configured by setting the <code>push</code> option of the remote, or the <code>push.default</code>
1810 configuration variable.</p></div>
1811 <div class="paragraph"><p>For example, to default to pushing only the current branch to <code>origin</code>
1812 use <code>git config remote.origin.push HEAD</code>. Any valid &lt;refspec&gt; (like
1813 the ones in the examples below) can be configured as the default for
1814 <code>git push origin</code>.</p></div>
1815 </dd>
1816 <dt class="hdlist1">
1817 <code>git push origin :</code>
1818 </dt>
1819 <dd>
1821 Push "matching" branches to <code>origin</code>. See
1822 &lt;refspec&gt; in the <a href="#OPTIONS">OPTIONS</a> section above for a
1823 description of "matching" branches.
1824 </p>
1825 </dd>
1826 <dt class="hdlist1">
1827 <code>git push origin master</code>
1828 </dt>
1829 <dd>
1831 Find a ref that matches <code>master</code> in the source repository
1832 (most likely, it would find <code>refs/heads/master</code>), and update
1833 the same ref (e.g. <code>refs/heads/master</code>) in <code>origin</code> repository
1834 with it. If <code>master</code> did not exist remotely, it would be
1835 created.
1836 </p>
1837 </dd>
1838 <dt class="hdlist1">
1839 <code>git push origin HEAD</code>
1840 </dt>
1841 <dd>
1843 A handy way to push the current branch to the same name on the
1844 remote.
1845 </p>
1846 </dd>
1847 <dt class="hdlist1">
1848 <code>git push mothership master:satellite/master dev:satellite/dev</code>
1849 </dt>
1850 <dd>
1852 Use the source ref that matches <code>master</code> (e.g. <code>refs/heads/master</code>)
1853 to update the ref that matches <code>satellite/master</code> (most probably
1854 <code>refs/remotes/satellite/master</code>) in the <code>mothership</code> repository;
1855 do the same for <code>dev</code> and <code>satellite/dev</code>.
1856 </p>
1857 <div class="paragraph"><p>See the section describing <code>&lt;refspec&gt;...</code> above for a discussion of
1858 the matching semantics.</p></div>
1859 <div class="paragraph"><p>This is to emulate <code>git fetch</code> run on the <code>mothership</code> using <code>git
1860 push</code> that is run in the opposite direction in order to integrate
1861 the work done on <code>satellite</code>, and is often necessary when you can
1862 only make connection in one way (i.e. satellite can ssh into
1863 mothership but mothership cannot initiate connection to satellite
1864 because the latter is behind a firewall or does not run sshd).</p></div>
1865 <div class="paragraph"><p>After running this <code>git push</code> on the <code>satellite</code> machine, you would
1866 ssh into the <code>mothership</code> and run <code>git merge</code> there to complete the
1867 emulation of <code>git pull</code> that were run on <code>mothership</code> to pull changes
1868 made on <code>satellite</code>.</p></div>
1869 </dd>
1870 <dt class="hdlist1">
1871 <code>git push origin HEAD:master</code>
1872 </dt>
1873 <dd>
1875 Push the current branch to the remote ref matching <code>master</code> in the
1876 <code>origin</code> repository. This form is convenient to push the current
1877 branch without thinking about its local name.
1878 </p>
1879 </dd>
1880 <dt class="hdlist1">
1881 <code>git push origin master:refs/heads/experimental</code>
1882 </dt>
1883 <dd>
1885 Create the branch <code>experimental</code> in the <code>origin</code> repository
1886 by copying the current <code>master</code> branch. This form is only
1887 needed to create a new branch or tag in the remote repository when
1888 the local name and the remote name are different; otherwise,
1889 the ref name on its own will work.
1890 </p>
1891 </dd>
1892 <dt class="hdlist1">
1893 <code>git push origin :experimental</code>
1894 </dt>
1895 <dd>
1897 Find a ref that matches <code>experimental</code> in the <code>origin</code> repository
1898 (e.g. <code>refs/heads/experimental</code>), and delete it.
1899 </p>
1900 </dd>
1901 <dt class="hdlist1">
1902 <code>git push origin +dev:master</code>
1903 </dt>
1904 <dd>
1906 Update the origin repository&#8217;s master branch with the dev branch,
1907 allowing non-fast-forward updates. <strong>This can leave unreferenced
1908 commits dangling in the origin repository.</strong> Consider the
1909 following situation, where a fast-forward is not possible:
1910 </p>
1911 <div class="listingblock">
1912 <div class="content">
1913 <pre><code> o---o---o---A---B origin/master
1915 X---Y---Z dev</code></pre>
1916 </div></div>
1917 <div class="paragraph"><p>The above command would change the origin repository to</p></div>
1918 <div class="listingblock">
1919 <div class="content">
1920 <pre><code> A---B (unnamed branch)
1922 o---o---o---X---Y---Z master</code></pre>
1923 </div></div>
1924 <div class="paragraph"><p>Commits A and B would no longer belong to a branch with a symbolic name,
1925 and so would be unreachable. As such, these commits would be removed by
1926 a <code>git gc</code> command on the origin repository.</p></div>
1927 </dd>
1928 </dl></div>
1929 </div>
1930 </div>
1931 <div class="sect1">
1932 <h2 id="_security">SECURITY</h2>
1933 <div class="sectionbody">
1934 <div class="paragraph"><p>The fetch and push protocols are not designed to prevent one side from
1935 stealing data from the other repository that was not intended to be
1936 shared. If you have private data that you need to protect from a malicious
1937 peer, your best option is to store it in another repository. This applies
1938 to both clients and servers. In particular, namespaces on a server are not
1939 effective for read access control; you should only grant read access to a
1940 namespace to clients that you would trust with read access to the entire
1941 repository.</p></div>
1942 <div class="paragraph"><p>The known attack vectors are as follows:</p></div>
1943 <div class="olist arabic"><ol class="arabic">
1944 <li>
1946 The victim sends "have" lines advertising the IDs of objects it has that
1947 are not explicitly intended to be shared but can be used to optimize the
1948 transfer if the peer also has them. The attacker chooses an object ID X
1949 to steal and sends a ref to X, but isn&#8217;t required to send the content of
1950 X because the victim already has it. Now the victim believes that the
1951 attacker has X, and it sends the content of X back to the attacker
1952 later. (This attack is most straightforward for a client to perform on a
1953 server, by creating a ref to X in the namespace the client has access
1954 to and then fetching it. The most likely way for a server to perform it
1955 on a client is to "merge" X into a public branch and hope that the user
1956 does additional work on this branch and pushes it back to the server
1957 without noticing the merge.)
1958 </p>
1959 </li>
1960 <li>
1962 As in #1, the attacker chooses an object ID X to steal. The victim sends
1963 an object Y that the attacker already has, and the attacker falsely
1964 claims to have X and not Y, so the victim sends Y as a delta against X.
1965 The delta reveals regions of X that are similar to Y to the attacker.
1966 </p>
1967 </li>
1968 </ol></div>
1969 </div>
1970 </div>
1971 <div class="sect1">
1972 <h2 id="_configuration">CONFIGURATION</h2>
1973 <div class="sectionbody">
1974 <div class="paragraph"><p>Everything below this line in this section is selectively included
1975 from the <a href="git-config.html">git-config(1)</a> documentation. The content is the same
1976 as what&#8217;s found there:</p></div>
1977 <div class="dlist"><dl>
1978 <dt class="hdlist1">
1979 push.autoSetupRemote
1980 </dt>
1981 <dd>
1983 If set to "true" assume <code>--set-upstream</code> on default push when no
1984 upstream tracking exists for the current branch; this option
1985 takes effect with push.default options <em>simple</em>, <em>upstream</em>,
1986 and <em>current</em>. It is useful if by default you want new branches
1987 to be pushed to the default remote (like the behavior of
1988 <em>push.default=current</em>) and you also want the upstream tracking
1989 to be set. Workflows most likely to benefit from this option are
1990 <em>simple</em> central workflows where all branches are expected to
1991 have the same name on the remote.
1992 </p>
1993 </dd>
1994 <dt class="hdlist1">
1995 push.default
1996 </dt>
1997 <dd>
1999 Defines the action <code>git push</code> should take if no refspec is
2000 given (whether from the command-line, config, or elsewhere).
2001 Different values are well-suited for
2002 specific workflows; for instance, in a purely central workflow
2003 (i.e. the fetch source is equal to the push destination),
2004 <code>upstream</code> is probably what you want. Possible values are:
2005 </p>
2006 <div class="openblock">
2007 <div class="content">
2008 <div class="ulist"><ul>
2009 <li>
2011 <code>nothing</code> - do not push anything (error out) unless a refspec is
2012 given. This is primarily meant for people who want to
2013 avoid mistakes by always being explicit.
2014 </p>
2015 </li>
2016 <li>
2018 <code>current</code> - push the current branch to update a branch with the same
2019 name on the receiving end. Works in both central and non-central
2020 workflows.
2021 </p>
2022 </li>
2023 <li>
2025 <code>upstream</code> - push the current branch back to the branch whose
2026 changes are usually integrated into the current branch (which is
2027 called <code>@{upstream}</code>). This mode only makes sense if you are
2028 pushing to the same repository you would normally pull from
2029 (i.e. central workflow).
2030 </p>
2031 </li>
2032 <li>
2034 <code>tracking</code> - This is a deprecated synonym for <code>upstream</code>.
2035 </p>
2036 </li>
2037 <li>
2039 <code>simple</code> - push the current branch with the same name on the remote.
2040 </p>
2041 <div class="paragraph"><p>If you are working on a centralized workflow (pushing to the same repository you
2042 pull from, which is typically <code>origin</code>), then you need to configure an upstream
2043 branch with the same name.</p></div>
2044 <div class="paragraph"><p>This mode is the default since Git 2.0, and is the safest option suited for
2045 beginners.</p></div>
2046 </li>
2047 <li>
2049 <code>matching</code> - push all branches having the same name on both ends.
2050 This makes the repository you are pushing to remember the set of
2051 branches that will be pushed out (e.g. if you always push <em>maint</em>
2052 and <em>master</em> there and no other branches, the repository you push
2053 to will have these two branches, and your local <em>maint</em> and
2054 <em>master</em> will be pushed there).
2055 </p>
2056 <div class="paragraph"><p>To use this mode effectively, you have to make sure <em>all</em> the
2057 branches you would push out are ready to be pushed out before
2058 running <em>git push</em>, as the whole point of this mode is to allow you
2059 to push all of the branches in one go. If you usually finish work
2060 on only one branch and push out the result, while other branches are
2061 unfinished, this mode is not for you. Also this mode is not
2062 suitable for pushing into a shared central repository, as other
2063 people may add new branches there, or update the tip of existing
2064 branches outside your control.</p></div>
2065 <div class="paragraph"><p>This used to be the default, but not since Git 2.0 (<code>simple</code> is the
2066 new default).</p></div>
2067 </li>
2068 </ul></div>
2069 </div></div>
2070 </dd>
2071 <dt class="hdlist1">
2072 push.followTags
2073 </dt>
2074 <dd>
2076 If set to true, enable <code>--follow-tags</code> option by default. You
2077 may override this configuration at time of push by specifying
2078 <code>--no-follow-tags</code>.
2079 </p>
2080 </dd>
2081 <dt class="hdlist1">
2082 push.gpgSign
2083 </dt>
2084 <dd>
2086 May be set to a boolean value, or the string <em>if-asked</em>. A true
2087 value causes all pushes to be GPG signed, as if <code>--signed</code> is
2088 passed to <a href="git-push.html">git-push(1)</a>. The string <em>if-asked</em> causes
2089 pushes to be signed if the server supports it, as if
2090 <code>--signed=if-asked</code> is passed to <em>git push</em>. A false value may
2091 override a value from a lower-priority config file. An explicit
2092 command-line flag always overrides this config option.
2093 </p>
2094 </dd>
2095 <dt class="hdlist1">
2096 push.pushOption
2097 </dt>
2098 <dd>
2100 When no <code>--push-option=&lt;option&gt;</code> argument is given from the
2101 command line, <code>git push</code> behaves as if each &lt;value&gt; of
2102 this variable is given as <code>--push-option=&lt;value&gt;</code>.
2103 </p>
2104 <div class="paragraph"><p>This is a multi-valued variable, and an empty value can be used in a
2105 higher priority configuration file (e.g. <code>.git/config</code> in a
2106 repository) to clear the values inherited from a lower priority
2107 configuration files (e.g. <code>$HOME/.gitconfig</code>).</p></div>
2108 <div class="listingblock">
2109 <div class="content">
2110 <pre><code>Example:
2112 /etc/gitconfig
2113 push.pushoption = a
2114 push.pushoption = b
2116 ~/.gitconfig
2117 push.pushoption = c
2119 repo/.git/config
2120 push.pushoption =
2121 push.pushoption = b
2123 This will result in only b (a and c are cleared).</code></pre>
2124 </div></div>
2125 </dd>
2126 <dt class="hdlist1">
2127 push.recurseSubmodules
2128 </dt>
2129 <dd>
2131 May be "check", "on-demand", "only", or "no", with the same behavior
2132 as that of "push --recurse-submodules".
2133 If not set, <em>no</em> is used by default, unless <em>submodule.recurse</em> is
2134 set (in which case a <em>true</em> value means <em>on-demand</em>).
2135 </p>
2136 </dd>
2137 <dt class="hdlist1">
2138 push.useForceIfIncludes
2139 </dt>
2140 <dd>
2142 If set to "true", it is equivalent to specifying
2143 <code>--force-if-includes</code> as an option to <a href="git-push.html">git-push(1)</a>
2144 in the command line. Adding <code>--no-force-if-includes</code> at the
2145 time of push overrides this configuration setting.
2146 </p>
2147 </dd>
2148 <dt class="hdlist1">
2149 push.negotiate
2150 </dt>
2151 <dd>
2153 If set to "true", attempt to reduce the size of the packfile
2154 sent by rounds of negotiation in which the client and the
2155 server attempt to find commits in common. If "false", Git will
2156 rely solely on the server&#8217;s ref advertisement to find commits
2157 in common.
2158 </p>
2159 </dd>
2160 <dt class="hdlist1">
2161 push.useBitmaps
2162 </dt>
2163 <dd>
2165 If set to "false", disable use of bitmaps for "git push" even if
2166 <code>pack.useBitmaps</code> is "true", without preventing other git operations
2167 from using bitmaps. Default is true.
2168 </p>
2169 </dd>
2170 </dl></div>
2171 </div>
2172 </div>
2173 <div class="sect1">
2174 <h2 id="_git">GIT</h2>
2175 <div class="sectionbody">
2176 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2177 </div>
2178 </div>
2179 </div>
2180 <div id="footnotes"><hr /></div>
2181 <div id="footer">
2182 <div id="footer-text">
2183 Last updated
2184 2023-10-29 16:42:00 PDT
2185 </div>
2186 </div>
2187 </body>
2188 </html>