<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="generator" content="AsciiDoc 7.0.2" /> | |
<style type="text/css"> | |
/* Debug borders */ | |
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { | |
/* | |
border: 1px solid red; | |
*/ | |
} | |
body { | |
margin: 1em 5% 1em 5%; | |
} | |
a { color: blue; } | |
a:visited { color: fuchsia; } | |
em { | |
font-style: italic; | |
} | |
strong { | |
font-weight: bold; | |
} | |
tt { | |
color: navy; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
color: #527bbd; | |
font-family: sans-serif; | |
margin-top: 1.2em; | |
margin-bottom: 0.5em; | |
line-height: 1.3; | |
} | |
h1 { | |
border-bottom: 2px solid silver; | |
} | |
h2 { | |
border-bottom: 2px solid silver; | |
padding-top: 0.5em; | |
} | |
div.sectionbody { | |
font-family: serif; | |
margin-left: 0; | |
} | |
hr { | |
border: 1px solid silver; | |
} | |
p { | |
margin-top: 0.5em; | |
margin-bottom: 0.5em; | |
} | |
pre { | |
padding: 0; | |
margin: 0; | |
} | |
span#author { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
font-size: 1.2em; | |
} | |
span#email { | |
} | |
span#revision { | |
font-family: sans-serif; | |
} | |
div#footer { | |
font-family: sans-serif; | |
font-size: small; | |
border-top: 2px solid silver; | |
padding-top: 0.5em; | |
margin-top: 4.0em; | |
} | |
div#footer-text { | |
float: left; | |
padding-bottom: 0.5em; | |
} | |
div#footer-badges { | |
float: right; | |
padding-bottom: 0.5em; | |
} | |
div#preamble, | |
div.tableblock, div.imageblock, div.exampleblock, div.verseblock, | |
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | |
div.admonitionblock { | |
margin-right: 10%; | |
margin-top: 1.5em; | |
margin-bottom: 1.5em; | |
} | |
div.admonitionblock { | |
margin-top: 2.5em; | |
margin-bottom: 2.5em; | |
} | |
div.content { /* Block element content. */ | |
padding: 0; | |
} | |
/* Block element titles. */ | |
div.title, caption.title { | |
font-family: sans-serif; | |
font-weight: bold; | |
text-align: left; | |
margin-top: 1.0em; | |
margin-bottom: 0.5em; | |
} | |
div.title + * { | |
margin-top: 0; | |
} | |
td div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content + div.title { | |
margin-top: 0.0em; | |
} | |
div.sidebarblock > div.content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.listingblock > div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock > div.content { | |
padding-left: 2.0em; | |
} | |
div.quoteblock .attribution { | |
text-align: right; | |
} | |
div.admonitionblock .icon { | |
vertical-align: top; | |
font-size: 1.1em; | |
font-weight: bold; | |
text-decoration: underline; | |
color: #527bbd; | |
padding-right: 0.5em; | |
} | |
div.admonitionblock td.content { | |
padding-left: 0.5em; | |
border-left: 2px solid silver; | |
} | |
div.exampleblock > div.content { | |
border-left: 2px solid silver; | |
padding: 0.5em; | |
} | |
div.verseblock div.content { | |
white-space: pre; | |
} | |
div.imageblock div.content { padding-left: 0; } | |
div.imageblock img { border: 1px solid silver; } | |
span.image img { border-style: none; } | |
dl { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
dt { | |
margin-top: 0.5em; | |
margin-bottom: 0; | |
font-style: italic; | |
} | |
dd > *:first-child { | |
margin-top: 0; | |
} | |
ul, ol { | |
list-style-position: outside; | |
} | |
ol.olist2 { | |
list-style-type: lower-alpha; | |
} | |
div.tableblock > table { | |
border-color: #527bbd; | |
border-width: 3px; | |
} | |
thead { | |
font-family: sans-serif; | |
font-weight: bold; | |
} | |
tfoot { | |
font-weight: bold; | |
} | |
div.hlist { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
td.hlist1 { | |
vertical-align: top; | |
font-style: italic; | |
padding-right: 0.8em; | |
} | |
td.hlist2 { | |
vertical-align: top; | |
} | |
@media print { | |
div#footer-badges { display: none; } | |
} | |
include::./stylesheets/xhtml11-manpage.css[] | |
/* Workarounds for IE6's broken and incomplete CSS2. */ | |
div.sidebar-content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.sidebar-title, div.image-title { | |
font-family: sans-serif; | |
font-weight: bold; | |
margin-top: 0.0em; | |
margin-bottom: 0.5em; | |
} | |
div.listingblock div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock-content { | |
padding-left: 2.0em; | |
} | |
div.exampleblock-content { | |
border-left: 2px solid silver; | |
padding-left: 0.5em; | |
} | |
</style> | |
<title>git-receive-pack(1)</title> | |
</head> | |
<body> | |
<div id="header"> | |
<h1> | |
git-receive-pack(1) Manual Page | |
</h1> | |
<h2>NAME</h2> | |
<div class="sectionbody"> | |
<p>git-receive-pack - | |
Receive what is pushed into the repository | |
</p> | |
</div> | |
</div> | |
<h2>SYNOPSIS</h2> | |
<div class="sectionbody"> | |
<p><em>git-receive-pack</em> <directory></p> | |
</div> | |
<h2>DESCRIPTION</h2> | |
<div class="sectionbody"> | |
<p>Invoked by <em>git-send-pack</em> and updates the repository with the | |
information fed from the remote end.</p> | |
<p>This command is usually not invoked directly by the end user. | |
The UI for the protocol is on the <em>git-send-pack</em> side, and the | |
program pair is meant to be used to push updates to remote | |
repository. For pull operations, see <em>git-fetch-pack</em>.</p> | |
<p>The command allows for creation and fast forwarding of sha1 refs | |
(heads/tags) on the remote end (strictly speaking, it is the | |
local end receive-pack runs, but to the user who is sitting at | |
the send-pack end, it is updating the remote. Confused?)</p> | |
<p>There are other real-world examples of using update and | |
post-update hooks found in the Documentation/howto directory.</p> | |
<p>git-receive-pack honours the receive.denyNonFastForwards config | |
option, which tells it if updates to a ref should be denied if they | |
are not fast-forwards.</p> | |
</div> | |
<h2>OPTIONS</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
<directory> | |
</dt> | |
<dd> | |
<p> | |
The repository to sync into. | |
</p> | |
</dd> | |
</dl> | |
</div> | |
<h2>pre-receive Hook</h2> | |
<div class="sectionbody"> | |
<p>Before any ref is updated, if $GIT_DIR/hooks/pre-receive file exists | |
and is executable, it will be invoked once with no parameters. The | |
standard input of the hook will be one line per ref to be updated:</p> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>sha1-old SP sha1-new SP refname LF</tt></pre> | |
</div></div> | |
<p>The refname value is relative to $GIT_DIR; e.g. for the master | |
head this is "refs/heads/master". The two sha1 values before | |
each refname are the object names for the refname before and after | |
the update. Refs to be created will have sha1-old equal to 0{40}, | |
while refs to be deleted will have sha1-new equal to 0{40}, otherwise | |
sha1-old and sha1-new should be valid objects in the repository.</p> | |
<p>This hook is called before any refname is updated and before any | |
fast-forward checks are performed.</p> | |
<p>If the pre-receive hook exits with a non-zero exit status no updates | |
will be performed, and the update, post-receive and post-update | |
hooks will not be invoked either. This can be useful to quickly | |
bail out if the update is not to be supported.</p> | |
</div> | |
<h2>update Hook</h2> | |
<div class="sectionbody"> | |
<p>Before each ref is updated, if $GIT_DIR/hooks/update file exists | |
and is executable, it is invoked once per ref, with three parameters:</p> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>$GIT_DIR/hooks/update refname sha1-old sha1-new</tt></pre> | |
</div></div> | |
<p>The refname parameter is relative to $GIT_DIR; e.g. for the master | |
head this is "refs/heads/master". The two sha1 arguments are | |
the object names for the refname before and after the update. | |
Note that the hook is called before the refname is updated, | |
so either sha1-old is 0{40} (meaning there is no such ref yet), | |
or it should match what is recorded in refname.</p> | |
<p>The hook should exit with non-zero status if it wants to disallow | |
updating the named ref. Otherwise it should exit with zero.</p> | |
<p>Successful execution (a zero exit status) of this hook does not | |
ensure the ref will actually be updated, it is only a prerequisite. | |
As such it is not a good idea to send notices (e.g. email) from | |
this hook. Consider using the post-receive hook instead.</p> | |
</div> | |
<h2>post-receive Hook</h2> | |
<div class="sectionbody"> | |
<p>After all refs were updated (or attempted to be updated), if any | |
ref update was successful, and if $GIT_DIR/hooks/post-receive | |
file exists and is executable, it will be invoke once with no | |
parameters. The standard input of the hook will be one line | |
for each successfully updated ref:</p> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>sha1-old SP sha1-new SP refname LF</tt></pre> | |
</div></div> | |
<p>The refname value is relative to $GIT_DIR; e.g. for the master | |
head this is "refs/heads/master". The two sha1 values before | |
each refname are the object names for the refname before and after | |
the update. Refs that were created will have sha1-old equal to | |
0{40}, while refs that were deleted will have sha1-new equal to | |
0{40}, otherwise sha1-old and sha1-new should be valid objects in | |
the repository.</p> | |
<p>Using this hook, it is easy to generate mails describing the updates | |
to the repository. This example script sends one mail message per | |
ref listing the commits pushed to the repository:</p> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>#!/bin/sh | |
# mail out commit update information. | |
while read oval nval ref | |
do | |
if expr "$oval" : '0*$' >/dev/null | |
then | |
echo "Created a new ref, with the following commits:" | |
git-rev-list --pretty "$nval" | |
else | |
echo "New commits:" | |
git-rev-list --pretty "$nval" "^$oval" | |
fi | | |
mail -s "Changes to ref $ref" commit-list@mydomain | |
done | |
exit 0</tt></pre> | |
</div></div> | |
<p>The exit code from this hook invocation is ignored, however a | |
non-zero exit code will generate an error message.</p> | |
<p>Note that it is possible for refname to not have sha1-new when this | |
hook runs. This can easily occur if another user modifies the ref | |
after it was updated by receive-pack, but before the hook was able | |
to evaluate it. It is recommended that hooks rely on sha1-new | |
rather than the current value of refname.</p> | |
</div> | |
<h2>post-update Hook</h2> | |
<div class="sectionbody"> | |
<p>After all other processing, if at least one ref was updated, and | |
if $GIT_DIR/hooks/post-update file exists and is executable, then | |
post-update will called with the list of refs that have been updated. | |
This can be used to implement any repository wide cleanup tasks.</p> | |
<p>The exit code from this hook invocation is ignored; the only thing | |
left for git-receive-pack to do at that point is to exit itself | |
anyway.</p> | |
<p>This hook can be used, for example, to run "git-update-server-info" | |
if the repository is packed and is served via a dumb transport.</p> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>#!/bin/sh | |
exec git-update-server-info</tt></pre> | |
</div></div> | |
</div> | |
<h2>SEE ALSO</h2> | |
<div class="sectionbody"> | |
<p><a href="git-send-pack.html">git-send-pack(1)</a></p> | |
</div> | |
<h2>Author</h2> | |
<div class="sectionbody"> | |
<p>Written by Linus Torvalds <torvalds@osdl.org></p> | |
</div> | |
<h2>Documentation</h2> | |
<div class="sectionbody"> | |
<p>Documentation by Junio C Hamano.</p> | |
</div> | |
<h2>GIT</h2> | |
<div class="sectionbody"> | |
<p>Part of the <a href="git.html">git(7)</a> suite</p> | |
</div> | |
<div id="footer"> | |
<div id="footer-text"> | |
Last updated 14-Nov-2007 12:11:44 UTC | |
</div> | |
</div> | |
</body> | |
</html> |