Updated git_doc to git 1.8
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / gitweb.xml
blobd9e5e25da7159a74f2719b430e09d09a3d304cf2
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="gitweb(1)">\r
5     <title>gitweb(1)</title>\r
6 <indexterm>\r
7 <primary>gitweb(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="gitweb(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>gitweb - Git web interface (web frontend to Git repositories)</simpara>\r
12 </simplesect>\r
13 <simplesect id="gitweb(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <simpara>To get started with gitweb, run <xref linkend="git-instaweb(1)" /> from a git repository.\r
16 This would configure and start your web server, and run web browser pointing to\r
17 gitweb.</simpara>\r
18 </simplesect>\r
19 <simplesect id="gitweb(1)__description">\r
20 <title>DESCRIPTION</title>\r
21 <simpara>Gitweb provides a web interface to git repositories.  Its features include:</simpara>\r
22 <itemizedlist>\r
23 <listitem>\r
24 <simpara>\r
25 Viewing multiple Git repositories with common root.\r
26 </simpara>\r
27 </listitem>\r
28 <listitem>\r
29 <simpara>\r
30 Browsing every revision of the repository.\r
31 </simpara>\r
32 </listitem>\r
33 <listitem>\r
34 <simpara>\r
35 Viewing the contents of files in the repository at any revision.\r
36 </simpara>\r
37 </listitem>\r
38 <listitem>\r
39 <simpara>\r
40 Viewing the revision log of branches, history of files and directories,\r
41   see what was changed when, by who.\r
42 </simpara>\r
43 </listitem>\r
44 <listitem>\r
45 <simpara>\r
46 Viewing the blame/annotation details of any file (if enabled).\r
47 </simpara>\r
48 </listitem>\r
49 <listitem>\r
50 <simpara>\r
51 Generating RSS and Atom feeds of commits, for any branch.\r
52   The feeds are auto-discoverable in modern web browsers.\r
53 </simpara>\r
54 </listitem>\r
55 <listitem>\r
56 <simpara>\r
57 Viewing everything that was changed in a revision, and step through\r
58   revisions one at a time, viewing the history of the repository.\r
59 </simpara>\r
60 </listitem>\r
61 <listitem>\r
62 <simpara>\r
63 Finding commits which commit messages matches given search term.\r
64 </simpara>\r
65 </listitem>\r
66 </itemizedlist>\r
67 <simpara>See <ulink url="http://git.kernel.org/?p=git/git.git;a=tree;f=gitweb">http://git.kernel.org/?p=git/git.git;a=tree;f=gitweb</ulink>[] or\r
68 <ulink url="http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/">http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/</ulink>[] for gitweb source code,\r
69 browsed using gitweb itself.</simpara>\r
70 </simplesect>\r
71 <simplesect id="gitweb(1)__configuration">\r
72 <title>CONFIGURATION</title>\r
73 <simpara>Various aspects of gitweb's behavior can be controlled through the configuration\r
74 file <emphasis>gitweb_config.perl</emphasis> or <emphasis>/etc/gitweb.conf</emphasis>.  See the <xref linkend="gitweb.conf(5)" />\r
75 for details.</simpara>\r
76 <section id="gitweb(1)__repositories">\r
77 <title>Repositories</title>\r
78 <simpara>Gitweb can show information from one or more Git repositories.  These\r
79 repositories have to be all on local filesystem, and have to share common\r
80 repository root, i.e. be all under a single parent repository (but see also\r
81 "Advanced web server setup" section, "Webserver configuration with multiple\r
82 projects' root" subsection).</simpara>\r
83 <screen>our $projectroot = '/path/to/parent/directory';</screen>\r
84 <simpara>The default value for <emphasis>$projectroot</emphasis> is <emphasis>/pub/git</emphasis>.  You can change it during\r
85 building gitweb via <emphasis>GITWEB_PROJECTROOT</emphasis> build configuration variable.</simpara>\r
86 <simpara>By default all git repositories under <emphasis>$projectroot</emphasis> are visible and available\r
87 to gitweb.  The list of projects is generated by default by scanning the\r
88 <emphasis>$projectroot</emphasis> directory for git repositories (for object databases to be\r
89 more exact; gitweb is not interested in a working area, and is best suited\r
90 to showing "bare" repositories).</simpara>\r
91 <simpara>The name of the repository in gitweb is the path to its <emphasis>$GIT_DIR</emphasis> (its object\r
92 database) relative to <emphasis>$projectroot</emphasis>.  Therefore the repository $repo can be\r
93 found at "$projectroot/$repo".</simpara>\r
94 </section>\r
95 <section id="gitweb(1)__projects_list_file_format">\r
96 <title>Projects list file format</title>\r
97 <simpara>Instead of having gitweb find repositories by scanning filesystem\r
98 starting from $projectroot, you can provide a pre-generated list of\r
99 visible projects by setting <emphasis>$projects_list</emphasis> to point to a plain text\r
100 file with a list of projects (with some additional info).</simpara>\r
101 <simpara>This file uses the following format:</simpara>\r
102 <itemizedlist>\r
103 <listitem>\r
104 <simpara>\r
105 One record (for project / repository) per line; does not support line\r
106 continuation (newline escaping).\r
107 </simpara>\r
108 </listitem>\r
109 <listitem>\r
110 <simpara>\r
111 Leading and trailing whitespace are ignored.\r
112 </simpara>\r
113 </listitem>\r
114 <listitem>\r
115 <simpara>\r
116 Whitespace separated fields; any run of whitespace can be used as field\r
117 separator (rules for Perl's "<emphasis>split(" ", $line)</emphasis>").\r
118 </simpara>\r
119 </listitem>\r
120 <listitem>\r
121 <simpara>\r
122 Fields use modified URI encoding, defined in RFC 3986, section 2.1\r
123 (Percent-Encoding), or rather "Query string encoding" (see\r
124 URL_encoding), the difference\r
125 being that SP (" ") can be encoded as "&#43;" (and therefore "&#43;" has to be\r
126 also percent-encoded).\r
127 </simpara>\r
128 <simpara>Reserved characters are: "%" (used for encoding), "&#43;" (can be used to\r
129 encode SPACE), all whitespace characters as defined in Perl, including SP,\r
130 TAB and LF, (used to separate fields in a record).</simpara>\r
131 </listitem>\r
132 <listitem>\r
133 <simpara>\r
134 Currently recognized fields are:\r
135 </simpara>\r
136 <variablelist>\r
137 <varlistentry>\r
138 <term>\r
139 &lt;repository path&gt;\r
140 </term>\r
141 <listitem>\r
142 <simpara>\r
143         path to repository GIT_DIR, relative to <emphasis>$projectroot</emphasis>\r
144 </simpara>\r
145 </listitem>\r
146 </varlistentry>\r
147 <varlistentry>\r
148 <term>\r
149 &lt;repository owner&gt;\r
150 </term>\r
151 <listitem>\r
152 <simpara>\r
153         displayed as repository owner, preferably full name, or email,\r
154         or both\r
155 </simpara>\r
156 </listitem>\r
157 </varlistentry>\r
158 </variablelist>\r
159 </listitem>\r
160 </itemizedlist>\r
161 <simpara>You can generate the projects list index file using the project_index action\r
162 (the <emphasis>TXT</emphasis> link on projects list page) directly from gitweb; see also\r
163 "Generating projects list using gitweb" section below.</simpara>\r
164 <simpara>Example contents:</simpara>\r
165 <screen>foo.git       Joe+R+Hacker+&lt;joe@example.com&gt;\r
166 foo/bar.git   O+W+Ner+&lt;owner@example.org&gt;</screen>\r
167 <simpara>By default this file controls only which projects are <emphasis role="strong">visible</emphasis> on projects\r
168 list page (note that entries that do not point to correctly recognized git\r
169 repositories won't be displayed by gitweb).  Even if a project is not\r
170 visible on projects list page, you can view it nevertheless by hand-crafting\r
171 a gitweb URL.  By setting <emphasis>$strict_export</emphasis> configuration variable (see\r
172 <xref linkend="gitweb.conf(5)" />) to true value you can allow viewing only of\r
173 repositories also shown on the overview page (i.e. only projects explicitly\r
174 listed in projects list file will be accessible).</simpara>\r
175 </section>\r
176 <section id="gitweb(1)__generating_projects_list_using_gitweb">\r
177 <title>Generating projects list using gitweb</title>\r
178 <simpara>We assume that GITWEB_CONFIG has its default Makefile value, namely\r
179 <emphasis>gitweb_config.perl</emphasis>. Put the following in <emphasis>gitweb_make_index.perl</emphasis> file:</simpara>\r
180 <screen>read_config_file("gitweb_config.perl");\r
181 $projects_list = $projectroot;</screen>\r
182 <simpara>Then create the following script to get list of project in the format\r
183 suitable for GITWEB_LIST build configuration variable (or\r
184 <emphasis>$projects_list</emphasis> variable in gitweb config):</simpara>\r
185 <screen>#!/bin/sh\r
187 export GITWEB_CONFIG="gitweb_make_index.perl"\r
188 export GATEWAY_INTERFACE="CGI/1.1"\r
189 export HTTP_ACCEPT="*/*"\r
190 export REQUEST_METHOD="GET"\r
191 export QUERY_STRING="a=project_index"\r
193 perl -- /var/www/cgi-bin/gitweb.cgi</screen>\r
194 <simpara>Run this script and save its output to a file.  This file could then be used\r
195 as projects list file, which means that you can set <emphasis>$projects_list</emphasis> to its\r
196 filename.</simpara>\r
197 </section>\r
198 <section id="gitweb(1)__controlling_access_to_git_repositories">\r
199 <title>Controlling access to git repositories</title>\r
200 <simpara>By default all git repositories under <emphasis>$projectroot</emphasis> are visible and\r
201 available to gitweb.  You can however configure how gitweb controls access\r
202 to repositories.</simpara>\r
203 <itemizedlist>\r
204 <listitem>\r
205 <simpara>\r
206 As described in "Projects list file format" section, you can control which\r
207 projects are <emphasis role="strong">visible</emphasis> by selectively including repositories in projects\r
208 list file, and setting <emphasis>$projects_list</emphasis> gitweb configuration variable to\r
209 point to it.  With <emphasis>$strict_export</emphasis> set, projects list file can be used to\r
210 control which repositories are <emphasis role="strong">available</emphasis> as well.\r
211 </simpara>\r
212 </listitem>\r
213 <listitem>\r
214 <simpara>\r
215 You can configure gitweb to only list and allow viewing of the explicitly\r
216 exported repositories, via <emphasis>$export_ok</emphasis> variable in gitweb config file; see\r
217 <xref linkend="gitweb.conf(5)" /> manpage.  If it evaluates to true, gitweb shows\r
218 repositories only if this file named by <emphasis>$export_ok</emphasis> exists in its object\r
219 database (if directory has the magic file named <emphasis>$export_ok</emphasis>).\r
220 </simpara>\r
221 <simpara>For example <xref linkend="git-daemon(1)" /> by default (unless <emphasis>--export-all</emphasis> option\r
222 is used) allows pulling only for those repositories that have\r
223 <emphasis>git-daemon-export-ok</emphasis> file.  Adding</simpara>\r
224 <screen>our $export_ok = "git-daemon-export-ok";</screen>\r
225 <simpara>makes gitweb show and allow access only to those repositories that can be\r
226 fetched from via <emphasis>git://</emphasis> protocol.</simpara>\r
227 </listitem>\r
228 <listitem>\r
229 <simpara>\r
230 Finally, it is possible to specify an arbitrary perl subroutine that will\r
231 be called for each repository to determine if it can be exported.  The\r
232 subroutine receives an absolute path to the project (repository) as its only\r
233 parameter (i.e. "$projectroot/$project").\r
234 </simpara>\r
235 <simpara>For example, if you use mod_perl to run the script, and have dumb\r
236 HTTP protocol authentication configured for your repositories, you\r
237 can use the following hook to allow access only if the user is\r
238 authorized to read the files:</simpara>\r
239 <screen>$export_auth_hook = sub {\r
240         use Apache2::SubRequest ();\r
241         use Apache2::Const -compile =&gt; qw(HTTP_OK);\r
242         my $path = "$_[0]/HEAD";\r
243         my $r    = Apache2::RequestUtil-&gt;request;\r
244         my $sub  = $r-&gt;lookup_file($path);\r
245         return $sub-&gt;filename eq $path\r
246             &amp;&amp; $sub-&gt;status == Apache2::Const::HTTP_OK;\r
247 };</screen>\r
248 </listitem>\r
249 </itemizedlist>\r
250 </section>\r
251 <section id="gitweb(1)__per_repository_gitweb_configuration">\r
252 <title>Per-repository gitweb configuration</title>\r
253 <simpara>You can configure individual repositories shown in gitweb by creating file\r
254 in the <emphasis>GIT_DIR</emphasis> of git repository, or by setting some repo configuration\r
255 variable (in <emphasis>GIT_DIR/config</emphasis>, see <xref linkend="git-config(1)" />).</simpara>\r
256 <simpara>You can use the following files in repository:</simpara>\r
257 <variablelist>\r
258 <varlistentry>\r
259 <term>\r
260 README.html\r
261 </term>\r
262 <listitem>\r
263 <simpara>\r
264         A html file (HTML fragment) which is included on the gitweb project\r
265         "summary" page inside <emphasis>&lt;div&gt;</emphasis> block element. You can use it for longer\r
266         description of a project, to provide links (for example to project's\r
267         homepage), etc. This is recognized only if XSS prevention is off\r
268         (<emphasis>$prevent_xss</emphasis> is false, see <xref linkend="gitweb.conf(5)" />); a way to include\r
269         a README safely when XSS prevention is on may be worked out in the\r
270         future.\r
271 </simpara>\r
272 </listitem>\r
273 </varlistentry>\r
274 <varlistentry>\r
275 <term>\r
276 description (or <emphasis>gitweb.description</emphasis>)\r
277 </term>\r
278 <listitem>\r
279 <simpara>\r
280         Short (shortened to <emphasis>$projects_list_description_width</emphasis> in the projects\r
281         list page, which is 25 characters by default; see\r
282         <xref linkend="gitweb.conf(5)" />) single line description of a project (of a\r
283         repository).  Plain text file; HTML will be escaped.  By default set to\r
284 </simpara>\r
285 <screen>Unnamed repository; edit this file to name it for gitweb.</screen>\r
286 <simpara>from the template during repository creation, usually installed in\r
287 <emphasis>/usr/share/git-core/templates/</emphasis>.  You can use the <emphasis>gitweb.description</emphasis> repo\r
288 configuration variable, but the file takes precedence.</simpara>\r
289 </listitem>\r
290 </varlistentry>\r
291 <varlistentry>\r
292 <term>\r
293 category (or <emphasis>gitweb.category</emphasis>)\r
294 </term>\r
295 <listitem>\r
296 <simpara>\r
297         Singe line category of a project, used to group projects if\r
298         <emphasis>$projects_list_group_categories</emphasis> is enabled.  By default (file and\r
299         configuration variable absent), uncategorized projects are put in the\r
300         <emphasis>$project_list_default_category</emphasis> category.  You can use the\r
301         <emphasis>gitweb.category</emphasis> repo configuration variable, but the file takes\r
302         precedence.\r
303 </simpara>\r
304 <simpara>The configuration variables <emphasis>$projects_list_group_categories</emphasis> and\r
305 <emphasis>$project_list_default_category</emphasis> are described in <xref linkend="gitweb.conf(5)" /></simpara>\r
306 </listitem>\r
307 </varlistentry>\r
308 <varlistentry>\r
309 <term>\r
310 cloneurl (or multiple-valued <emphasis>gitweb.url</emphasis>)\r
311 </term>\r
312 <listitem>\r
313 <simpara>\r
314         File with repository URL (used for clone and fetch), one per line.\r
315         Displayed in the project summary page. You can use multiple-valued\r
316         <emphasis>gitweb.url</emphasis> repository configuration variable for that, but the file\r
317         takes precedence.\r
318 </simpara>\r
319 <simpara>This is per-repository enhancement / version of global prefix-based\r
320 <emphasis>@git_base_url_list</emphasis> gitweb configuration variable (see\r
321 <xref linkend="gitweb.conf(5)" />).</simpara>\r
322 </listitem>\r
323 </varlistentry>\r
324 <varlistentry>\r
325 <term>\r
326 gitweb.owner\r
327 </term>\r
328 <listitem>\r
329 <simpara>\r
330         You can use the <emphasis>gitweb.owner</emphasis> repository configuration variable to set\r
331         repository's owner.  It is displayed in the project list and summary\r
332         page.\r
333 </simpara>\r
334 <simpara>If it's not set, filesystem directory's owner is used (via GECOS field,\r
335 i.e. real name field from <emphasis role="strong">getpwuid</emphasis>(3)) if <emphasis>$projects_list</emphasis> is unset\r
336 (gitweb scans <emphasis>$projectroot</emphasis> for repositories); if <emphasis>$projects_list</emphasis>\r
337 points to file with list of repositories, then project owner defaults to\r
338 value from this file for given repository.</simpara>\r
339 </listitem>\r
340 </varlistentry>\r
341 <varlistentry>\r
342 <term>\r
343 various <emphasis>gitweb.*</emphasis> config variables (in config)\r
344 </term>\r
345 <listitem>\r
346 <simpara>\r
347         Read description of <emphasis>%feature</emphasis> hash for detailed list, and descriptions.\r
348         See also "Configuring gitweb features" section in <xref linkend="gitweb.conf(5)" />\r
349 </simpara>\r
350 </listitem>\r
351 </varlistentry>\r
352 </variablelist>\r
353 </section>\r
354 </simplesect>\r
355 <simplesect id="gitweb(1)__actions_and_urls">\r
356 <title>ACTIONS, AND URLS</title>\r
357 <simpara>Gitweb can use path_info (component) based URLs, or it can pass all necessary\r
358 information via query parameters.  The typical gitweb URLs are broken down in to\r
359 five components:</simpara>\r
360 <screen>.../gitweb.cgi/&lt;repo&gt;/&lt;action&gt;/&lt;revision&gt;:/&lt;path&gt;?&lt;arguments&gt;</screen>\r
361 <variablelist>\r
362 <varlistentry>\r
363 <term>\r
364 repo\r
365 </term>\r
366 <listitem>\r
367 <simpara>\r
368         The repository the action will be performed on.\r
369 </simpara>\r
370 <simpara>All actions except for those that list all available projects,\r
371 in whatever form, require this parameter.</simpara>\r
372 </listitem>\r
373 </varlistentry>\r
374 <varlistentry>\r
375 <term>\r
376 action\r
377 </term>\r
378 <listitem>\r
379 <simpara>\r
380         The action that will be run.  Defaults to <emphasis>projects_list</emphasis> if repo\r
381         is not set, and to <emphasis>summary</emphasis> otherwise.\r
382 </simpara>\r
383 </listitem>\r
384 </varlistentry>\r
385 <varlistentry>\r
386 <term>\r
387 revision\r
388 </term>\r
389 <listitem>\r
390 <simpara>\r
391         Revision shown.  Defaults to HEAD.\r
392 </simpara>\r
393 </listitem>\r
394 </varlistentry>\r
395 <varlistentry>\r
396 <term>\r
397 path\r
398 </term>\r
399 <listitem>\r
400 <simpara>\r
401         The path within the &lt;repository&gt; that the action is performed on,\r
402         for those actions that require it.\r
403 </simpara>\r
404 </listitem>\r
405 </varlistentry>\r
406 <varlistentry>\r
407 <term>\r
408 arguments\r
409 </term>\r
410 <listitem>\r
411 <simpara>\r
412         Any arguments that control the behaviour of the action.\r
413 </simpara>\r
414 </listitem>\r
415 </varlistentry>\r
416 </variablelist>\r
417 <simpara>Some actions require or allow to specify two revisions, and sometimes even two\r
418 pathnames.  In most general form such path_info (component) based gitweb URL\r
419 looks like this:</simpara>\r
420 <screen>.../gitweb.cgi/&lt;repo&gt;/&lt;action&gt;/&lt;revision_from&gt;:/&lt;path_from&gt;..&lt;revision_to&gt;:/&lt;path_to&gt;?&lt;arguments&gt;</screen>\r
421 <simpara>Each action is implemented as a subroutine, and must be present in %actions\r
422 hash.  Some actions are disabled by default, and must be turned on via feature\r
423 mechanism.  For example to enable <emphasis>blame</emphasis> view add the following to gitweb\r
424 configuration file:</simpara>\r
425 <screen>$feature{'blame'}{'default'} = [1];</screen>\r
426 <section id="gitweb(1)__actions">\r
427 <title>Actions:</title>\r
428 <simpara>The standard actions are:</simpara>\r
429 <variablelist>\r
430 <varlistentry>\r
431 <term>\r
432 project_list\r
433 </term>\r
434 <listitem>\r
435 <simpara>\r
436         Lists the available Git repositories.  This is the default command if no\r
437         repository is specified in the URL.\r
438 </simpara>\r
439 </listitem>\r
440 </varlistentry>\r
441 <varlistentry>\r
442 <term>\r
443 summary\r
444 </term>\r
445 <listitem>\r
446 <simpara>\r
447         Displays summary about given repository.  This is the default command if\r
448         no action is specified in URL, and only repository is specified.\r
449 </simpara>\r
450 </listitem>\r
451 </varlistentry>\r
452 <varlistentry>\r
453 <term>\r
454 heads\r
455 </term>\r
456 <term>\r
457 remotes\r
458 </term>\r
459 <listitem>\r
460 <simpara>\r
461         Lists all local or all remote-tracking branches in given repository.\r
462 </simpara>\r
463 <simpara>The latter is not available by default, unless configured.</simpara>\r
464 </listitem>\r
465 </varlistentry>\r
466 <varlistentry>\r
467 <term>\r
468 tags\r
469 </term>\r
470 <listitem>\r
471 <simpara>\r
472         List all tags (lightweight and annotated) in given repository.\r
473 </simpara>\r
474 </listitem>\r
475 </varlistentry>\r
476 <varlistentry>\r
477 <term>\r
478 blob\r
479 </term>\r
480 <term>\r
481 tree\r
482 </term>\r
483 <listitem>\r
484 <simpara>\r
485         Shows the files and directories in a given repository path, at given\r
486         revision.  This is default command if no action is specified in the URL,\r
487         and path is given.\r
488 </simpara>\r
489 </listitem>\r
490 </varlistentry>\r
491 <varlistentry>\r
492 <term>\r
493 blob_plain\r
494 </term>\r
495 <listitem>\r
496 <simpara>\r
497         Returns the raw data for the file in given repository, at given path and\r
498         revision.  Links to this action are marked <emphasis>raw</emphasis>.\r
499 </simpara>\r
500 </listitem>\r
501 </varlistentry>\r
502 <varlistentry>\r
503 <term>\r
504 blobdiff\r
505 </term>\r
506 <listitem>\r
507 <simpara>\r
508         Shows the difference between two revisions of the same file.\r
509 </simpara>\r
510 </listitem>\r
511 </varlistentry>\r
512 <varlistentry>\r
513 <term>\r
514 blame\r
515 </term>\r
516 <term>\r
517 blame_incremental\r
518 </term>\r
519 <listitem>\r
520 <simpara>\r
521         Shows the blame (also called annotation) information for a file. On a\r
522         per line basis it shows the revision in which that line was last changed\r
523         and the user that committed the change.  The incremental version (which\r
524         if configured is used automatically when JavaScript is enabled) uses\r
525         Ajax to incrementally add blame info to the contents of given file.\r
526 </simpara>\r
527 <simpara>This action is disabled by default for performance reasons.</simpara>\r
528 </listitem>\r
529 </varlistentry>\r
530 <varlistentry>\r
531 <term>\r
532 commit\r
533 </term>\r
534 <term>\r
535 commitdiff\r
536 </term>\r
537 <listitem>\r
538 <simpara>\r
539         Shows information about a specific commit in a repository.  The <emphasis>commit</emphasis>\r
540         view shows information about commit in more detail, the <emphasis>commitdiff</emphasis>\r
541         action shows changeset for given commit.\r
542 </simpara>\r
543 </listitem>\r
544 </varlistentry>\r
545 <varlistentry>\r
546 <term>\r
547 patch\r
548 </term>\r
549 <listitem>\r
550 <simpara>\r
551         Returns the commit in plain text mail format, suitable for applying with\r
552         <xref linkend="git-am(1)" />.\r
553 </simpara>\r
554 </listitem>\r
555 </varlistentry>\r
556 <varlistentry>\r
557 <term>\r
558 tag\r
559 </term>\r
560 <listitem>\r
561 <simpara>\r
562         Display specific annotated tag (tag object).\r
563 </simpara>\r
564 </listitem>\r
565 </varlistentry>\r
566 <varlistentry>\r
567 <term>\r
568 log\r
569 </term>\r
570 <term>\r
571 shortlog\r
572 </term>\r
573 <listitem>\r
574 <simpara>\r
575         Shows log information (commit message or just commit subject) for a\r
576         given branch (starting from given revision).\r
577 </simpara>\r
578 <simpara>The <emphasis>shortlog</emphasis> view is more compact; it shows one commit per line.</simpara>\r
579 </listitem>\r
580 </varlistentry>\r
581 <varlistentry>\r
582 <term>\r
583 history\r
584 </term>\r
585 <listitem>\r
586 <simpara>\r
587         Shows history of the file or directory in a given repository path,\r
588         starting from given revision (defaults to HEAD, i.e. default branch).\r
589 </simpara>\r
590 <simpara>This view is similar to <emphasis>shortlog</emphasis> view.</simpara>\r
591 </listitem>\r
592 </varlistentry>\r
593 <varlistentry>\r
594 <term>\r
595 rss\r
596 </term>\r
597 <term>\r
598 atom\r
599 </term>\r
600 <listitem>\r
601 <simpara>\r
602         Generates an RSS (or Atom) feed of changes to repository.\r
603 </simpara>\r
604 </listitem>\r
605 </varlistentry>\r
606 </variablelist>\r
607 </section>\r
608 </simplesect>\r
609 <simplesect id="gitweb(1)__webserver_configuration">\r
610 <title>WEBSERVER CONFIGURATION</title>\r
611 <simpara>This section explains how to configure some common webservers to run gitweb. In\r
612 all cases, <emphasis>/path/to/gitweb</emphasis> in the examples is the directory you ran installed\r
613 gitweb in, and contains <emphasis>gitweb_config.perl</emphasis>.</simpara>\r
614 <simpara>If you've configured a web server that isn't listed here for gitweb, please send\r
615 in the instructions so they can be included in a future release.</simpara>\r
616 <section id="gitweb(1)__apache_as_cgi">\r
617 <title>Apache as CGI</title>\r
618 <simpara>Apache must be configured to support CGI scripts in the directory in\r
619 which gitweb is installed.  Let's assume that it is <emphasis>/var/www/cgi-bin</emphasis>\r
620 directory.</simpara>\r
621 <screen>ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"\r
623 &lt;Directory "/var/www/cgi-bin"&gt;\r
624     Options Indexes FollowSymlinks ExecCGI\r
625     AllowOverride None\r
626     Order allow,deny\r
627     Allow from all\r
628 &lt;/Directory&gt;</screen>\r
629 <simpara>With that configuration the full path to browse repositories would be:</simpara>\r
630 <literallayout class="monospaced">http://server/cgi-bin/gitweb.cgi</literallayout>\r
631 </section>\r
632 <section id="gitweb(1)__apache_with_mod_perl_via_modperl_registry">\r
633 <title>Apache with mod_perl, via ModPerl::Registry</title>\r
634 <simpara>You can use mod_perl with gitweb.  You must install Apache::Registry\r
635 (for mod_perl 1.x) or ModPerl::Registry (for mod_perl 2.x) to enable\r
636 this support.</simpara>\r
637 <simpara>Assuming that gitweb is installed to <emphasis>/var/www/perl</emphasis>, the following\r
638 Apache configuration (for mod_perl 2.x) is suitable.</simpara>\r
639 <screen>Alias /perl "/var/www/perl"\r
641 &lt;Directory "/var/www/perl"&gt;\r
642     SetHandler perl-script\r
643     PerlResponseHandler ModPerl::Registry\r
644     PerlOptions +ParseHeaders\r
645     Options Indexes FollowSymlinks +ExecCGI\r
646     AllowOverride None\r
647     Order allow,deny\r
648     Allow from all\r
649 &lt;/Directory&gt;</screen>\r
650 <simpara>With that configuration the full path to browse repositories would be:</simpara>\r
651 <literallayout class="monospaced">http://server/perl/gitweb.cgi</literallayout>\r
652 </section>\r
653 <section id="gitweb(1)__apache_with_fastcgi">\r
654 <title>Apache with FastCGI</title>\r
655 <simpara>Gitweb works with Apache and FastCGI.  First you need to rename, copy\r
656 or symlink gitweb.cgi to gitweb.fcgi.  Let's assume that gitweb is\r
657 installed in <emphasis>/usr/share/gitweb</emphasis> directory.  The following Apache\r
658 configuration is suitable (UNTESTED!)</simpara>\r
659 <screen>FastCgiServer /usr/share/gitweb/gitweb.cgi\r
660 ScriptAlias /gitweb /usr/share/gitweb/gitweb.cgi\r
662 Alias /gitweb/static /usr/share/gitweb/static\r
663 &lt;Directory /usr/share/gitweb/static&gt;\r
664     SetHandler default-handler\r
665 &lt;/Directory&gt;</screen>\r
666 <simpara>With that configuration the full path to browse repositories would be:</simpara>\r
667 <literallayout class="monospaced">http://server/gitweb</literallayout>\r
668 </section>\r
669 </simplesect>\r
670 <simplesect id="gitweb(1)__advanced_web_server_setup">\r
671 <title>ADVANCED WEB SERVER SETUP</title>\r
672 <simpara>All of those examples use request rewriting, and need <emphasis>mod_rewrite</emphasis>\r
673 (or equivalent; examples below are written for Apache).</simpara>\r
674 <section id="gitweb(1)__single_url_for_gitweb_and_for_fetching">\r
675 <title>Single URL for gitweb and for fetching</title>\r
676 <simpara>If you want to have one URL for both gitweb and your <emphasis>http://</emphasis>\r
677 repositories, you can configure Apache like this:</simpara>\r
678 <screen>&lt;VirtualHost *:80&gt;\r
679     ServerName    git.example.org\r
680     DocumentRoot  /pub/git\r
681     SetEnv        GITWEB_CONFIG   /etc/gitweb.conf\r
683     # turning on mod rewrite\r
684     RewriteEngine on\r
686     # make the front page an internal rewrite to the gitweb script\r
687     RewriteRule ^/$  /cgi-bin/gitweb.cgi\r
689     # make access for "dumb clients" work\r
690     RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ \\r
691                 /cgi-bin/gitweb.cgi%{REQUEST_URI}  [L,PT]\r
692 &lt;/VirtualHost&gt;</screen>\r
693 <simpara>The above configuration expects your public repositories to live under\r
694 <emphasis>/pub/git</emphasis> and will serve them as <emphasis>http://git.domain.org/dir-under-pub-git</emphasis>,\r
695 both as cloneable GIT URL and as browseable gitweb interface.  If you then\r
696 start your <xref linkend="git-daemon(1)" /> with <emphasis>--base-path=/pub/git --export-all</emphasis>\r
697 then you can even use the <emphasis>git://</emphasis> URL with exactly the same path.</simpara>\r
698 <simpara>Setting the environment variable <emphasis>GITWEB_CONFIG</emphasis> will tell gitweb to use the\r
699 named file (i.e. in this example <emphasis>/etc/gitweb.conf</emphasis>) as a configuration for\r
700 gitweb.  You don't really need it in above example; it is required only if\r
701 your configuration file is in different place than built-in (during\r
702 compiling gitweb) <emphasis>gitweb_config.perl</emphasis> or <emphasis>/etc/gitweb.conf</emphasis>.  See\r
703 <xref linkend="gitweb.conf(5)" /> for details, especially information about precedence\r
704 rules.</simpara>\r
705 <simpara>If you use the rewrite rules from the example you <emphasis role="strong">might</emphasis> also need\r
706 something like the following in your gitweb configuration file\r
707 (<emphasis>/etc/gitweb.conf</emphasis> following example):</simpara>\r
708 <screen>@stylesheets = ("/some/absolute/path/gitweb.css");\r
709 $my_uri    = "/";\r
710 $home_link = "/";\r
711 $per_request_config = 1;</screen>\r
712 <simpara>Nowadays though gitweb should create HTML base tag when needed (to set base\r
713 URI for relative links), so it should work automatically.</simpara>\r
714 </section>\r
715 <section id="gitweb(1)__webserver_configuration_with_multiple_projects_root">\r
716 <title>Webserver configuration with multiple projects' root</title>\r
717 <simpara>If you want to use gitweb with several project roots you can edit your\r
718 Apache virtual host and gitweb configuration files in the following way.</simpara>\r
719 <simpara>The virtual host configuration (in Apache configuration file) should look\r
720 like this:</simpara>\r
721 <screen>&lt;VirtualHost *:80&gt;\r
722     ServerName    git.example.org\r
723     DocumentRoot  /pub/git\r
724     SetEnv        GITWEB_CONFIG  /etc/gitweb.conf\r
726     # turning on mod rewrite\r
727     RewriteEngine on\r
729     # make the front page an internal rewrite to the gitweb script\r
730     RewriteRule ^/$  /cgi-bin/gitweb.cgi  [QSA,L,PT]\r
732     # look for a public_git folder in unix users' home\r
733     # http://git.example.org/~&lt;user&gt;/\r
734     RewriteRule ^/\~([^\/]+)(/|/gitweb.cgi)?$   /cgi-bin/gitweb.cgi \\r
735                 [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\r
737     # http://git.example.org/+&lt;user&gt;/\r
738     #RewriteRule ^/\+([^\/]+)(/|/gitweb.cgi)?$  /cgi-bin/gitweb.cgi \\r
739                  [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\r
741     # http://git.example.org/user/&lt;user&gt;/\r
742     #RewriteRule ^/user/([^\/]+)/(gitweb.cgi)?$ /cgi-bin/gitweb.cgi \\r
743                  [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]\r
745     # defined list of project roots\r
746     RewriteRule ^/scm(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \\r
747                 [QSA,E=GITWEB_PROJECTROOT:/pub/scm/,L,PT]\r
748     RewriteRule ^/var(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \\r
749                 [QSA,E=GITWEB_PROJECTROOT:/var/git/,L,PT]\r
751     # make access for "dumb clients" work\r
752     RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ \\r
753                 /cgi-bin/gitweb.cgi%{REQUEST_URI}  [L,PT]\r
754 &lt;/VirtualHost&gt;</screen>\r
755 <simpara>Here actual project root is passed to gitweb via <emphasis>GITWEB_PROJECT_ROOT</emphasis>\r
756 environment variable from a web server, so you need to put the following\r
757 line in gitweb configuration file (<emphasis>/etc/gitweb.conf</emphasis> in above example):</simpara>\r
758 <screen>$projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/pub/git";</screen>\r
759 <simpara><emphasis role="strong">Note</emphasis> that this requires to be set for each request, so either\r
760 <emphasis>$per_request_config</emphasis> must be false, or the above must be put in code\r
761 referenced by <emphasis>$per_request_config</emphasis>;</simpara>\r
762 <simpara>These configurations enable two things. First, each unix user (<emphasis>&lt;user&gt;</emphasis>) of\r
763 the server will be able to browse through gitweb git repositories found in\r
764 <emphasis>~/public_git/</emphasis> with the following url:</simpara>\r
765 <literallayout class="monospaced">http://git.example.org/~&lt;user&gt;/</literallayout>\r
766 <simpara>If you do not want this feature on your server just remove the second\r
767 rewrite rule.</simpara>\r
768 <simpara>If you already use mod_userdir` in your virtual host or you don't want to\r
769 use the '~ as first character, just comment or remove the second rewrite\r
770 rule, and uncomment one of the following according to what you want.</simpara>\r
771 <simpara>Second, repositories found in <emphasis>/pub/scm/</emphasis> and <emphasis>/var/git/</emphasis> will be accessible\r
772 through <emphasis>http://git.example.org/scm/</emphasis> and <emphasis>http://git.example.org/var/</emphasis>.\r
773 You can add as many project roots as you want by adding rewrite rules like\r
774 the third and the fourth.</simpara>\r
775 </section>\r
776 <section id="gitweb(1)__path_info_usage">\r
777 <title>PATH_INFO usage</title>\r
778 <simpara>If you enable PATH_INFO usage in gitweb by putting</simpara>\r
779 <screen>$feature{'pathinfo'}{'default'} = [1];</screen>\r
780 <simpara>in your gitweb configuration file, it is possible to set up your server so\r
781 that it consumes and produces URLs in the form</simpara>\r
782 <literallayout class="monospaced">http://git.example.com/project.git/shortlog/sometag</literallayout>\r
783 <simpara>i.e. without <emphasis>gitweb.cgi</emphasis> part, by using a configuration such as the\r
784 following.  This configuration assumes that <emphasis>/var/www/gitweb</emphasis> is the\r
785 DocumentRoot of your webserver, contains the gitweb.cgi script and\r
786 complementary static files (stylesheet, favicon, JavaScript):</simpara>\r
787 <screen>&lt;VirtualHost *:80&gt;\r
788         ServerAlias git.example.com\r
790         DocumentRoot /var/www/gitweb\r
792         &lt;Directory /var/www/gitweb&gt;\r
793                 Options ExecCGI\r
794                 AddHandler cgi-script cgi\r
796                 DirectoryIndex gitweb.cgi\r
798                 RewriteEngine On\r
799                 RewriteCond %{REQUEST_FILENAME} !-f\r
800                 RewriteCond %{REQUEST_FILENAME} !-d\r
801                 RewriteRule ^.* /gitweb.cgi/$0 [L,PT]\r
802         &lt;/Directory&gt;\r
803 &lt;/VirtualHost&gt;</screen>\r
804 <simpara>The rewrite rule guarantees that existing static files will be properly\r
805 served, whereas any other URL will be passed to gitweb as PATH_INFO\r
806 parameter.</simpara>\r
807 <simpara><emphasis role="strong">Notice</emphasis> that in this case you don't need special settings for\r
808 <emphasis>@stylesheets</emphasis>, <emphasis>$my_uri</emphasis> and <emphasis>$home_link</emphasis>, but you lose "dumb client"\r
809 access to your project .git dirs (described in "Single URL for gitweb and\r
810 for fetching" section).  A possible workaround for the latter is the\r
811 following: in your project root dir (e.g. <emphasis>/pub/git</emphasis>) have the projects\r
812 named <emphasis role="strong">without</emphasis> a .git extension (e.g. <emphasis>/pub/git/project</emphasis> instead of\r
813 <emphasis>/pub/git/project.git</emphasis>) and configure Apache as follows:</simpara>\r
814 <screen>&lt;VirtualHost *:80&gt;\r
815         ServerAlias git.example.com\r
817         DocumentRoot /var/www/gitweb\r
819         AliasMatch ^(/.*?)(\.git)(/.*)?$ /pub/git$1$3\r
820         &lt;Directory /var/www/gitweb&gt;\r
821                 Options ExecCGI\r
822                 AddHandler cgi-script cgi\r
824                 DirectoryIndex gitweb.cgi\r
826                 RewriteEngine On\r
827                 RewriteCond %{REQUEST_FILENAME} !-f\r
828                 RewriteCond %{REQUEST_FILENAME} !-d\r
829                 RewriteRule ^.* /gitweb.cgi/$0 [L,PT]\r
830         &lt;/Directory&gt;\r
831 &lt;/VirtualHost&gt;</screen>\r
832 <simpara>The additional AliasMatch makes it so that</simpara>\r
833 <literallayout class="monospaced">http://git.example.com/project.git</literallayout>\r
834 <simpara>will give raw access to the project's git dir (so that the project can be\r
835 cloned), while</simpara>\r
836 <literallayout class="monospaced">http://git.example.com/project</literallayout>\r
837 <simpara>will provide human-friendly gitweb access.</simpara>\r
838 <simpara>This solution is not 100% bulletproof, in the sense that if some project has\r
839 a named ref (branch, tag) starting with <emphasis>git/</emphasis>, then paths such as</simpara>\r
840 <literallayout class="monospaced">http://git.example.com/project/command/abranch..git/abranch</literallayout>\r
841 <simpara>will fail with a 404 error.</simpara>\r
842 </section>\r
843 </simplesect>\r
844 <simplesect id="gitweb(1)__bugs">\r
845 <title>BUGS</title>\r
846 <simpara>Please report any bugs or feature requests to <ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>,\r
847 putting "gitweb" in the subject of email.</simpara>\r
848 </simplesect>\r
849 <simplesect id="gitweb(1)__see_also">\r
850 <title>SEE ALSO</title>\r
851 <simpara><xref linkend="gitweb.conf(5)" />, <xref linkend="git-instaweb(1)" /></simpara>\r
852 <simpara><emphasis>gitweb/README</emphasis>, <emphasis>gitweb/INSTALL</emphasis></simpara>\r
853 </simplesect>\r
854 <simplesect id="gitweb(1)__git">\r
855 <title>GIT</title>\r
856 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
857 </simplesect>\r
858 </sect2>\r