1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.5.2" />
7 <title>git-daemon(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.5em;
116 margin-bottom: 1.5em;
118 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
119 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
120 div
.admonitionblock
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.0em;
131 div
.content
{ /* Block element content. */
135 /* Block element titles. */
136 div
.title
, caption
.title
{
138 font-family: sans-serif
;
142 margin-bottom: 0.5em;
148 td div
.title:first-child
{
151 div
.content div
.title:first-child
{
154 div
.content
+ div
.title
{
158 div
.sidebarblock
> div
.content
{
160 border: 1px solid silver
;
164 div
.listingblock
> div
.content
{
165 border: 1px solid silver
;
170 div
.quoteblock
, div
.verseblock
{
174 border-left: 5px solid
#dddddd;
178 div
.quoteblock
> div
.attribution
{
183 div
.verseblock
> div
.content
{
186 div
.verseblock
> div
.attribution
{
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div
.verseblock
+ div
.attribution
{
195 div
.admonitionblock
.icon
{
199 text-decoration: underline
;
201 padding-right: 0.5em;
203 div
.admonitionblock td
.content
{
205 border-left: 3px solid
#dddddd;
208 div
.exampleblock
> div
.content
{
209 border-left: 3px solid
#dddddd;
213 div
.imageblock div
.content
{ padding-left: 0; }
214 span
.image img
{ border-style: none
; }
215 a
.image:visited
{ color: white
; }
219 margin-bottom: 0.8em;
232 list-style-position: outside
;
235 list-style-type: decimal
;
238 list-style-type: lower-alpha
;
241 list-style-type: upper-alpha
;
244 list-style-type: lower-roman
;
247 list-style-type: upper-roman
;
250 div
.compact ul
, div
.compact ol
,
251 div
.compact p
, div
.compact p
,
252 div
.compact div
, div
.compact div
{
254 margin-bottom: 0.1em;
257 div
.tableblock
> table
{
258 border: 3px solid
#527bbd;
260 thead
, p
.table
.header
{
261 font-family: sans-serif
;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div
.tableblock
> table
[frame
="void"] {
277 div
.tableblock
> table
[frame
="hsides"] {
278 border-left-style: none
;
279 border-right-style: none
;
281 div
.tableblock
> table
[frame
="vsides"] {
282 border-top-style: none
;
283 border-bottom-style: none
;
289 margin-bottom: 0.8em;
292 padding-bottom: 15px;
294 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
300 padding-right: 0.8em;
306 div
.hdlist
.compact tr
{
315 .footnote, .footnoteref {
319 span
.footnote
, span
.footnoteref
{
320 vertical-align: super
;
324 margin: 20px 0 20px 0;
328 #footnotes div
.footnote
{
334 border-top: 1px solid silver
;
344 div#footer-badges
{ display: none
; }
348 margin-bottom: 2.5em;
353 font-family: sans-serif
;
357 margin-bottom: 0.1em;
360 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
376 /* Overrides for manpage documents */
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver
;
381 border-bottom: 2px solid silver
;
391 div#toc
{ display: none
; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div
.sidebar-content
{
398 border: 1px solid silver
;
401 div
.sidebar-title
, div
.image-title
{
403 font-family: sans-serif
;
406 margin-bottom: 0.5em;
409 div
.listingblock div
.content
{
410 border: 1px solid silver
;
415 div
.quoteblock-attribution
{
420 div
.verseblock-content
{
423 div
.verseblock-attribution
{
428 div
.exampleblock-content
{
429 border-left: 3px solid
#dddddd;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc
a:visited
{ color: blue
; }
436 <script type=
"text/javascript">
438 window
.onload = function(){asciidoc
.footnotes();}
439 var asciidoc
= { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
459 toc: function (toclevels
) {
461 function getText(el
) {
463 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
464 if (i
.nodeType
== 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
466 else if (i
.firstChild
!= null)
472 function TocEntry(el
, text
, toclevel
) {
475 this.toclevel
= toclevel
;
478 function tocEntries(el
, toclevels
) {
479 var result
= new Array
;
480 var re
= new RegExp('[hH]([2-'+(toclevels
+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
484 var iterate = function (el
) {
485 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
486 if (i
.nodeType
== 1 /* Node.ELEMENT_NODE */) {
487 var mo
= re
.exec(i
.tagName
);
488 if (mo
&& (i
.getAttribute("class") || i
.getAttribute("className")) != "float") {
489 result
[result
.length
] = new TocEntry(i
, getText(i
), mo
[1]-1);
499 var toc
= document
.getElementById("toc");
500 var entries
= tocEntries(document
.getElementById("content"), toclevels
);
501 for (var i
= 0; i
< entries
.length
; ++i
) {
502 var entry
= entries
[i
];
503 if (entry
.element
.id
== "")
504 entry
.element
.id
= "_toc_" + i
;
505 var a
= document
.createElement("a");
506 a
.href
= "#" + entry
.element
.id
;
507 a
.appendChild(document
.createTextNode(entry
.text
));
508 var div
= document
.createElement("div");
510 div
.className
= "toclevel" + entry
.toclevel
;
511 toc
.appendChild(div
);
513 if (entries
.length
== 0)
514 toc
.parentNode
.removeChild(toc
);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont
= document
.getElementById("content");
528 var noteholder
= document
.getElementById("footnotes");
529 var spans
= cont
.getElementsByTagName("span");
532 for (i
=0; i
<spans
.length
; i
++) {
533 if (spans
[i
].className
== "footnote") {
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note
= spans
[i
].innerHTML
.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder
.innerHTML
+=
539 "<div class='footnote' id='_footnote_" + n
+ "'>" +
540 "<a href='#_footnoteref_" + n
+ "' title='Return to text'>" +
541 n
+ "</a>. " + note
+ "</div>";
543 "[<a id='_footnoteref_" + n
+ "' href='#_footnote_" + n
+
544 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
545 var id
=spans
[i
].getAttribute("id");
546 if (id
!= null) refs
["#"+id
] = n
;
550 noteholder
.parentNode
.removeChild(noteholder
);
552 // Process footnoterefs.
553 for (i
=0; i
<spans
.length
; i
++) {
554 if (spans
[i
].className
== "footnoteref") {
555 var href
= spans
[i
].getElementsByTagName("a")[0].getAttribute("href");
556 href
= href
.match(/#.*/)[0]; // Because IE return full URL.
559 "[<a href='#_footnote_" + n
+
560 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
573 git-daemon(
1) Manual Page
576 <div class=
"sectionbody">
578 A really simple server for git repositories
583 <h2 id=
"_synopsis">SYNOPSIS
</h2>
584 <div class=
"sectionbody">
585 <div class=
"verseblock">
586 <div class=
"verseblock-content"><em>git daemon
</em> [--verbose] [--syslog] [--export-all]
587 [--timeout=
<n
>] [--init-timeout=
<n
>] [--max-connections=
<n
>]
588 [--strict-paths] [--base-path=
<path
>] [--base-path-relaxed]
589 [--user-path | --user-path=
<path
>]
590 [--interpolated-path=
<pathtemplate
>]
591 [--reuseaddr] [--detach] [--pid-file=
<file
>]
592 [--enable=
<service
>] [--disable=
<service
>]
593 [--allow-override=
<service
>] [--forbid-override=
<service
>]
594 [--inetd | [--listen=
<host_or_ipaddr
>] [--port=
<n
>] [--user=
<user
> [--group=
<group
>]]
595 [
<directory
>…]
</div>
596 <div class=
"verseblock-attribution">
599 <h2 id=
"_description">DESCRIPTION
</h2>
600 <div class=
"sectionbody">
601 <div class=
"paragraph"><p>A really simple TCP git daemon that normally listens on port
"DEFAULT_GIT_PORT"
602 aka
9418. It waits for a connection asking for a service, and will serve
603 that service if it is enabled.
</p></div>
604 <div class=
"paragraph"><p>It verifies that the directory has the magic file
"git-daemon-export-ok", and
605 it will refuse to export any git directory that hasn
’t explicitly been marked
606 for export this way (unless the
<em>--export-all
</em> parameter is specified). If you
607 pass some directory paths as
<em>git daemon
</em> arguments, you can further restrict
608 the offers to a whitelist comprising of those.
</p></div>
609 <div class=
"paragraph"><p>By default, only
<tt>upload-pack
</tt> service is enabled, which serves
610 <em>git fetch-pack
</em> and
<em>git ls-remote
</em> clients, which are invoked
611 from
<em>git fetch
</em>,
<em>git pull
</em>, and
<em>git clone
</em>.
</p></div>
612 <div class=
"paragraph"><p>This is ideally suited for read-only updates, i.e., pulling from
613 git repositories.
</p></div>
614 <div class=
"paragraph"><p>An
<tt>upload-archive
</tt> also exists to serve
<em>git archive
</em>.
</p></div>
616 <h2 id=
"_options">OPTIONS
</h2>
617 <div class=
"sectionbody">
618 <div class=
"dlist"><dl>
624 Match paths exactly (i.e. don
’t allow
"/foo/repo" when the real path is
625 "/foo/repo.git" or
"/foo/repo/.git") and don
’t do user-relative paths.
626 <em>git daemon
</em> will refuse to start when this option is enabled and no
627 whitelist is specified.
631 --base-path=
<path
>
635 Remap all the path requests as relative to the given path.
636 This is sort of
"GIT root" - if you run
<em>git daemon
</em> with
637 <em>--base-path=/srv/git
</em> on example.com, then if you later try to pull
638 <em>git://example.com/hello.git
</em>,
<em>git daemon
</em> will interpret the path
639 as
<em>/srv/git/hello.git
</em>.
647 If --base-path is enabled and repo lookup fails, with this option
648 <em>git daemon
</em> will attempt to lookup without prefixing the base path.
649 This is useful for switching to --base-path usage, while still
650 allowing the old paths.
654 --interpolated-path=
<pathtemplate
>
658 To support virtual hosting, an interpolated path template can be
659 used to dynamically construct alternate paths. The template
660 supports %H for the target hostname as supplied by the client but
661 converted to all lowercase, %CH for the canonical hostname,
662 %IP for the server
’s IP address, %P for the port number,
663 and %D for the absolute path of the named repository.
664 After interpolation, the path is validated against the directory
673 Allow pulling from all directories that look like GIT repositories
674 (have the
<em>objects
</em> and
<em>refs
</em> subdirectories), even if they
675 do not have the
<em>git-daemon-export-ok
</em> file.
683 Have the server run as an inetd service. Implies --syslog.
684 Incompatible with --detach, --port, --listen, --user and --group
689 --listen=
<host_or_ipaddr
>
693 Listen on a specific IP address or hostname. IP addresses can
694 be either an IPv4 address or an IPv6 address if supported. If IPv6
695 is not supported, then --listen=hostname is also not supported and
696 --listen must be given an IPv4 address.
697 Can be given more than once.
698 Incompatible with
<em>--inetd
</em> option.
706 Listen on an alternative port. Incompatible with
<em>--inetd
</em> option.
710 --init-timeout=
<n
>
714 Timeout (in seconds) between the moment the connection is established
715 and the client request is received (typically a rather low value, since
716 that should be basically immediate).
724 Timeout (in seconds) for specific client sub-requests. This includes
725 the time it takes for the server to process the sub-request and the
726 time spent waiting for the next client
’s request.
730 --max-connections=
<n
>
734 Maximum number of concurrent clients, defaults to
32. Set it to
743 Log to syslog instead of stderr. Note that this option does not imply
744 --verbose, thus by default only error conditions will be logged.
751 --user-path=
<path
>
755 Allow
~user notation to be used in requests. When
756 specified with no parameter, requests to
757 git://host/
~alice/foo is taken as a request to access
758 <em>foo
</em> repository in the home directory of user
<tt>alice
</tt>.
759 If
<tt>--user-path=path
</tt> is specified, the same request is
760 taken as a request to access
<tt>path/foo
</tt> repository in
761 the home directory of user
<tt>alice
</tt>.
769 Log details about the incoming connections and requested files.
777 Use SO_REUSEADDR when binding the listening socket.
778 This allows the server to restart without waiting for
779 old connections to time out.
787 Detach from the shell. Implies --syslog.
791 --pid-file=
<file
>
795 Save the process id in
<em>file
</em>. Ignored when the daemon
796 is run under
<tt>--inetd
</tt>.
803 --group=
<group
>
807 Change daemon
’s uid and gid before entering the service loop.
808 When only
<tt>--user
</tt> is given without
<tt>--group
</tt>, the
809 primary group ID for the user is used. The values of
810 the option are given to
<tt>getpwnam(
3)
</tt> and
<tt>getgrnam(
3)
</tt>
811 and numeric IDs are not supported.
813 <div class=
"paragraph"><p>Giving these options is an error when used with
<tt>--inetd
</tt>; use
814 the facility of inet daemon to achieve the same before spawning
815 <em>git daemon
</em> if needed.
</p></div>
818 --enable=
<service
>
821 --disable=
<service
>
825 Enable/disable the service site-wide per default. Note
826 that a service disabled site-wide can still be enabled
827 per repository if it is marked overridable and the
828 repository enables the service with a configuration
833 --allow-override=
<service
>
836 --forbid-override=
<service
>
840 Allow/forbid overriding the site-wide default with per
841 repository configuration. By default, all the services
850 A directory to add to the whitelist of allowed directories. Unless
851 --strict-paths is specified this will also include subdirectories
852 of each named directory.
857 <h2 id=
"_services">SERVICES
</h2>
858 <div class=
"sectionbody">
859 <div class=
"paragraph"><p>These services can be globally enabled/disabled using the
860 command line options of this command. If a finer-grained
861 control is desired (e.g. to allow
<em>git archive
</em> to be run
862 against only in a few selected repositories the daemon serves),
863 the per-repository configuration file can be used to enable or
864 disable them.
</p></div>
865 <div class=
"dlist"><dl>
871 This serves
<em>git fetch-pack
</em> and
<em>git ls-remote
</em>
872 clients. It is enabled by default, but a repository can
873 disable it by setting
<tt>daemon.uploadpack
</tt> configuration
874 item to
<tt>false
</tt>.
882 This serves
<em>git archive --remote
</em>. It is disabled by
883 default, but a repository can enable it by setting
884 <tt>daemon.uploadarch
</tt> configuration item to
<tt>true
</tt>.
892 This serves
<em>git send-pack
</em> clients, allowing anonymous
893 push. It is disabled by default, as there is
<em>no
</em>
894 authentication in the protocol (in other words, anybody
895 can push anything into the repository, including removal
896 of refs). This is solely meant for a closed LAN setting
897 where everybody is friendly. This service can be
898 enabled by
<tt>daemon.receivepack
</tt> configuration item to
904 <h2 id=
"_examples">EXAMPLES
</h2>
905 <div class=
"sectionbody">
906 <div class=
"dlist"><dl>
908 We assume the following in /etc/services
911 <div class=
"listingblock">
912 <div class=
"content">
913 <pre><tt>$ grep
9418 /etc/services
914 git
9418/tcp # Git Version Control System
</tt></pre>
918 <em>git daemon
</em> as inetd server
922 To set up
<em>git daemon
</em> as an inetd service that handles any
923 repository under the whitelisted set of directories, /pub/foo
924 and /pub/bar, place an entry like the following into
925 /etc/inetd all on one line:
927 <div class=
"listingblock">
928 <div class=
"content">
929 <pre><tt> git stream tcp nowait nobody /usr/bin/git
930 git daemon --inetd --verbose --export-all
931 /pub/foo /pub/bar
</tt></pre>
935 <em>git daemon
</em> as inetd server for virtual hosts
939 To set up
<em>git daemon
</em> as an inetd service that handles
940 repositories for different virtual hosts,
<tt>www.example.com
</tt>
941 and
<tt>www.example.org
</tt>, place an entry like the following into
942 <tt>/etc/inetd
</tt> all on one line:
944 <div class=
"listingblock">
945 <div class=
"content">
946 <pre><tt> git stream tcp nowait nobody /usr/bin/git
947 git daemon --inetd --verbose --export-all
948 --interpolated-path=/pub/%H%D
949 /pub/www.example.org/software
950 /pub/www.example.com/software
953 <div class=
"paragraph"><p>In this example, the root-level directory
<tt>/pub
</tt> will contain
954 a subdirectory for each virtual host name supported.
955 Further, both hosts advertise repositories simply as
956 <tt>git://www.example.com/software/repo.git
</tt>. For pre-
1.4.0
957 clients, a symlink from
<tt>/software
</tt> into the appropriate
958 default repository could be made as well.
</p></div>
961 <em>git daemon
</em> as regular daemon for virtual hosts
965 To set up
<em>git daemon
</em> as a regular, non-inetd service that
966 handles repositories for multiple virtual hosts based on
967 their IP addresses, start the daemon like this:
969 <div class=
"listingblock">
970 <div class=
"content">
971 <pre><tt> git daemon --verbose --export-all
972 --interpolated-path=/pub/%IP/%D
973 /pub/
192.168.1.200/software
974 /pub/
10.10.220.23/software
</tt></pre>
976 <div class=
"paragraph"><p>In this example, the root-level directory
<tt>/pub
</tt> will contain
977 a subdirectory for each virtual host IP address supported.
978 Repositories can still be accessed by hostname though, assuming
979 they correspond to these IP addresses.
</p></div>
982 selectively enable/disable services per repository
986 To enable
<em>git archive --remote
</em> and disable
<em>git fetch
</em> against
987 a repository, have the following in the configuration file in the
988 repository (that is the file
<em>config
</em> next to
<em>HEAD
</em>,
<em>refs
</em> and
991 <div class=
"listingblock">
992 <div class=
"content">
995 uploadarch = true
</tt></pre>
1000 <h2 id=
"_environment">ENVIRONMENT
</h2>
1001 <div class=
"sectionbody">
1002 <div class=
"paragraph"><p><em>git daemon
</em> will set REMOTE_ADDR to the IP address of the client
1003 that connected to it, if the IP address is available. REMOTE_ADDR will
1004 be available in the environment of hooks called when
1005 services are performed.
</p></div>
1007 <h2 id=
"_git">GIT
</h2>
1008 <div class=
"sectionbody">
1009 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1012 <div id=
"footnotes"><hr /></div>
1014 <div id=
"footer-text">
1015 Last updated
2011-
09-
21 23:
01:
14 PDT