sync with girocco/v2.11.4+
[git/gitweb.git] / Documentation / gitweb.txt
blobfd63ede0583e859e10edbfa1a4ba636d385580c3
1 gitweb(1)
2 =========
4 NAME
5 ----
6 gitweb - Git web interface (web frontend to Git repositories)
8 SYNOPSIS
9 --------
10 To get started with gitweb, run linkgit:git-instaweb[1] from a Git repository.
11 This would configure and start your web server, and run web browser pointing to
12 gitweb.
15 DESCRIPTION
16 -----------
17 Gitweb provides a web interface to Git repositories.  Its features include:
19 * Viewing multiple Git repositories with common root.
20 * Browsing every revision of the repository.
21 * Viewing the contents of files in the repository at any revision.
22 * Viewing the revision log of branches, history of files and directories,
23   see what was changed when, by who.
24 * Viewing the blame/annotation details of any file (if enabled).
25 * Generating RSS and Atom feeds of commits, for any branch.
26   The feeds are auto-discoverable in modern web browsers.
27 * Viewing everything that was changed in a revision, and step through
28   revisions one at a time, viewing the history of the repository.
29 * Finding commits which commit messages matches given search term.
31 See http://git.kernel.org/?p=git/git.git;a=tree;f=gitweb[] or
32 http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
33 browsed using gitweb itself.
36 CONFIGURATION
37 -------------
38 Various aspects of gitweb's behavior can be controlled through the configuration
39 file 'gitweb_config.perl' or '/etc/gitweb.conf'.  See the linkgit:gitweb.conf[5]
40 for details.
42 Repositories
43 ~~~~~~~~~~~~
44 Gitweb can show information from one or more Git repositories.  These
45 repositories have to be all on local filesystem, and have to share common
46 repository root, i.e. be all under a single parent repository (but see also
47 "Advanced web server setup" section, "Webserver configuration with multiple
48 projects' root" subsection).
50 -----------------------------------------------------------------------
51 our $projectroot = '/path/to/parent/directory';
52 -----------------------------------------------------------------------
54 The default value for `$projectroot` is '/pub/git'.  You can change it during
55 building gitweb via `GITWEB_PROJECTROOT` build configuration variable.
57 By default all Git repositories under `$projectroot` are visible and available
58 to gitweb.  The list of projects is generated by default by scanning the
59 `$projectroot` directory for Git repositories (for object databases to be
60 more exact; gitweb is not interested in a working area, and is best suited
61 to showing "bare" repositories).
63 The name of the repository in gitweb is the path to its `$GIT_DIR` (its object
64 database) relative to `$projectroot`.  Therefore the repository $repo can be
65 found at "$projectroot/$repo".
68 Projects list file format
69 ~~~~~~~~~~~~~~~~~~~~~~~~~
70 Instead of having gitweb find repositories by scanning filesystem
71 starting from $projectroot, you can provide a pre-generated list of
72 visible projects by setting `$projects_list` to point to a plain text
73 file with a list of projects (with some additional info).
75 This file uses the following format:
77 * One record (for project / repository) per line; does not support line
78 continuation (newline escaping).
80 * Leading and trailing whitespace are ignored.
82 * Whitespace separated fields; any run of whitespace can be used as field
83 separator (rules for Perl's "`split(" ", $line)`").
85 * Fields use modified URI encoding, defined in RFC 3986, section 2.1
86 (Percent-Encoding), or rather "Query string encoding" (see
87 http://en.wikipedia.org/wiki/Query_string#URL_encoding[]), the difference
88 being that SP (" ") can be encoded as "{plus}" (and therefore "{plus}" has to be
89 also percent-encoded).
91 Reserved characters are: "%" (used for encoding), "{plus}" (can be used to
92 encode SPACE), all whitespace characters as defined in Perl, including SP,
93 TAB and LF, (used to separate fields in a record).
95 * Currently recognized fields are:
96 <repository path>::
97         path to repository GIT_DIR, relative to `$projectroot`
98 <repository owner>::
99         displayed as repository owner, preferably full name, or email,
100         or both
102 You can generate the projects list index file using the project_index action
103 (the 'TXT' link on projects list page) directly from gitweb; see also
104 "Generating projects list using gitweb" section below.
106 Example contents:
107 -----------------------------------------------------------------------
108 foo.git       Joe+R+Hacker+<joe@example.com>
109 foo/bar.git   O+W+Ner+<owner@example.org>
110 -----------------------------------------------------------------------
113 By default this file controls only which projects are *visible* on projects
114 list page (note that entries that do not point to correctly recognized Git
115 repositories won't be displayed by gitweb).  Even if a project is not
116 visible on projects list page, you can view it nevertheless by hand-crafting
117 a gitweb URL.  By setting `$strict_export` configuration variable (see
118 linkgit:gitweb.conf[5]) to true value you can allow viewing only of
119 repositories also shown on the overview page (i.e. only projects explicitly
120 listed in projects list file will be accessible).
123 Generating projects list using gitweb
124 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126 We assume that GITWEB_CONFIG has its default Makefile value, namely
127 'gitweb_config.perl'. Put the following in 'gitweb_make_index.perl' file:
128 ----------------------------------------------------------------------------
129 read_config_file("gitweb_config.perl");
130 $projects_list = $projectroot;
131 ----------------------------------------------------------------------------
133 Then create the following script to get list of project in the format
134 suitable for GITWEB_LIST build configuration variable (or
135 `$projects_list` variable in gitweb config):
137 ----------------------------------------------------------------------------
138 #!/bin/sh
140 export GITWEB_CONFIG="gitweb_make_index.perl"
141 export GATEWAY_INTERFACE="CGI/1.1"
142 export HTTP_ACCEPT="*/*"
143 export REQUEST_METHOD="GET"
144 export QUERY_STRING="a=project_index"
146 perl -- /var/www/cgi-bin/gitweb.cgi
147 ----------------------------------------------------------------------------
149 Run this script and save its output to a file.  This file could then be used
150 as projects list file, which means that you can set `$projects_list` to its
151 filename.
154 Controlling access to Git repositories
155 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156 By default all Git repositories under `$projectroot` are visible and
157 available to gitweb.  You can however configure how gitweb controls access
158 to repositories.
160 * As described in "Projects list file format" section, you can control which
161 projects are *visible* by selectively including repositories in projects
162 list file, and setting `$projects_list` gitweb configuration variable to
163 point to it.  With `$strict_export` set, projects list file can be used to
164 control which repositories are *available* as well.
166 * You can configure gitweb to only list and allow viewing of the explicitly
167 exported repositories, via `$export_ok` variable in gitweb config file; see
168 linkgit:gitweb.conf[5] manpage.  If it evaluates to true, gitweb shows
169 repositories only if this file named by `$export_ok` exists in its object
170 database (if directory has the magic file named `$export_ok`).
172 For example linkgit:git-daemon[1] by default (unless `--export-all` option
173 is used) allows pulling only for those repositories that have
174 'git-daemon-export-ok' file.  Adding
176 --------------------------------------------------------------------------
177 our $export_ok = "git-daemon-export-ok";
178 --------------------------------------------------------------------------
180 makes gitweb show and allow access only to those repositories that can be
181 fetched from via `git://` protocol.
183 * Finally, it is possible to specify an arbitrary perl subroutine that will
184 be called for each repository to determine if it can be exported.  The
185 subroutine receives an absolute path to the project (repository) as its only
186 parameter (i.e. "$projectroot/$project").
188 For example, if you use mod_perl to run the script, and have dumb
189 HTTP protocol authentication configured for your repositories, you
190 can use the following hook to allow access only if the user is
191 authorized to read the files:
193 --------------------------------------------------------------------------
194 $export_auth_hook = sub {
195         use Apache2::SubRequest ();
196         use Apache2::Const -compile => qw(HTTP_OK);
197         my $path = "$_[0]/HEAD";
198         my $r    = Apache2::RequestUtil->request;
199         my $sub  = $r->lookup_file($path);
200         return $sub->filename eq $path
201             && $sub->status == Apache2::Const::HTTP_OK;
203 --------------------------------------------------------------------------
206 Per-repository gitweb configuration
207 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208 You can configure individual repositories shown in gitweb by creating file
209 in the `GIT_DIR` of Git repository, or by setting some repo configuration
210 variable (in `GIT_DIR/config`, see linkgit:git-config[1]).
212 You can use the following files in repository:
214 README.html::
215         A html file (HTML fragment) which is included on the gitweb project
216         "summary" page inside `<div>` block element. You can use it for longer
217         description of a project, to provide links (for example to project's
218         homepage), etc. This is recognized only if XSS prevention is off
219         (`$prevent_xss` is false, see linkgit:gitweb.conf[5]); a way to include
220         a README safely when XSS prevention is on may be worked out in the
221         future.
223 description (or `gitweb.description`)::
224         Short (shortened to `$projects_list_description_width` in the projects
225         list page, which is 25 characters by default; see
226         linkgit:gitweb.conf[5]) single line description of a project (of a
227         repository).  Plain text file; HTML will be escaped.  By default set to
229 -------------------------------------------------------------------------------
230 Unnamed repository; edit this file to name it for gitweb.
231 -------------------------------------------------------------------------------
233 from the template during repository creation, usually installed in
234 '/usr/share/git-core/templates/'.  You can use the `gitweb.description` repo
235 configuration variable, but the file takes precedence.
237 category (or `gitweb.category`)::
238         Singe line category of a project, used to group projects if
239         `$projects_list_group_categories` is enabled.  By default (file and
240         configuration variable absent), uncategorized projects are put in the
241         `$project_list_default_category` category.  You can use the
242         `gitweb.category` repo configuration variable, but the file takes
243         precedence.
245 The configuration variables `$projects_list_group_categories` and
246 `$project_list_default_category` are described in linkgit:gitweb.conf[5]
248 cloneurl (or multiple-valued `gitweb.url`)::
249         File with repository URL (used for clone and fetch), one per line.
250         Displayed in the project summary page. You can use multiple-valued
251         `gitweb.url` repository configuration variable for that, but the file
252         takes precedence.
254 This is per-repository enhancement / version of global prefix-based
255 `@git_base_url_list` gitweb configuration variable (see
256 linkgit:gitweb.conf[5]).
258 gitweb.owner::
259         You can use the `gitweb.owner` repository configuration variable to set
260         repository's owner.  It is displayed in the project list and summary
261         page.
263 If it's not set, filesystem directory's owner is used (via GECOS field,
264 i.e. real name field from *getpwuid*(3)) if `$projects_list` is unset
265 (gitweb scans `$projectroot` for repositories); if `$projects_list`
266 points to file with list of repositories, then project owner defaults to
267 value from this file for given repository.
269 gitweb.homepage::
270         You can use the `gitweb.homepage` repository configuration variable to
271         set the repository's home page URL.  If set, it is displayed on the
272         project summary page.
274 various `gitweb.*` config variables (in config)::
275         Read description of `%feature` hash for detailed list, and descriptions.
276         See also "Configuring gitweb features" section in linkgit:gitweb.conf[5]
279 ACTIONS, AND URLS
280 -----------------
281 Gitweb can use path_info (component) based URLs, or it can pass all necessary
282 information via query parameters.  The typical gitweb URLs are broken down in to
283 five components:
285 -----------------------------------------------------------------------
286 .../gitweb.cgi/<repo>/<action>/<revision>:/<path>?<arguments>
287 -----------------------------------------------------------------------
289 repo::
290         The repository the action will be performed on.
292 All actions except for those that list all available projects,
293 in whatever form, require this parameter.
295 action::
296         The action that will be run.  Defaults to 'projects_list' if repo
297         is not set, and to 'summary' otherwise.
299 revision::
300         Revision shown.  Defaults to HEAD.
302 path::
303         The path within the <repository> that the action is performed on,
304         for those actions that require it.
306 arguments::
307         Any arguments that control the behaviour of the action.
309 Some actions require or allow to specify two revisions, and sometimes even two
310 pathnames.  In most general form such path_info (component) based gitweb URL
311 looks like this:
313 -----------------------------------------------------------------------
314 .../gitweb.cgi/<repo>/<action>/<revision_from>:/<path_from>..<revision_to>:/<path_to>?<arguments>
315 -----------------------------------------------------------------------
318 Each action is implemented as a subroutine, and must be present in %actions
319 hash.  Some actions are disabled by default, and must be turned on via feature
320 mechanism.  For example to enable 'blame' view add the following to gitweb
321 configuration file:
323 -----------------------------------------------------------------------
324 $feature{'blame'}{'default'} = [1];
325 -----------------------------------------------------------------------
328 Actions:
329 ~~~~~~~~
330 The standard actions are:
332 frontpage::
333         Same as project_list unless `$frontpage_no_project_list` is set to a
334         non-zero value.  This is the default command if no repository is
335         specified in the URL.
337 project_list::
338         Lists the available Git repositories.
340 summary::
341         Displays summary about given repository.  This is the default command if
342         no action is specified in URL, and only repository is specified.
344 heads::
345 remotes::
346         Lists all local or all remote-tracking branches in given repository.
348 The latter is not available by default, unless configured.
350 tags::
351         List all tags (lightweight and annotated) in given repository.
353 blob::
354 tree::
355         Shows the files and directories in a given repository path, at given
356         revision.  This is default command if no action is specified in the URL,
357         and path is given.
359 blob_plain::
360         Returns the raw data for the file in given repository, at given path and
361         revision.  Links to this action are marked 'raw'.
363 blobdiff::
364         Shows the difference between two revisions of the same file.
366 blame::
367 blame_incremental::
368         Shows the blame (also called annotation) information for a file. On a
369         per line basis it shows the revision in which that line was last changed
370         and the user that committed the change.  The incremental version (which
371         if configured is used automatically when JavaScript is enabled) uses
372         Ajax to incrementally add blame info to the contents of given file.
374 This action is disabled by default for performance reasons.
376 commit::
377 commitdiff::
378         Shows information about a specific commit in a repository.  The 'commit'
379         view shows information about commit in more detail, the 'commitdiff'
380         action shows changeset for given commit.
382 patch::
383         Returns the commit in plain text mail format, suitable for applying with
384         linkgit:git-am[1].
386 tag::
387         Display specific annotated tag (tag object).
389 log::
390 shortlog::
391         Shows log information (commit message or just commit subject) for a
392         given branch (starting from given revision).
394 The 'shortlog' view is more compact; it shows one commit per line.
396 history::
397         Shows history of the file or directory in a given repository path,
398         starting from given revision (defaults to HEAD, i.e. default branch).
400 This view is similar to 'shortlog' view.
402 rss::
403 atom::
404         Generates an RSS (or Atom) feed of changes to repository.
407 WEBSERVER CONFIGURATION
408 -----------------------
409 This section explains how to configure some common webservers to run gitweb. In
410 all cases, `/path/to/gitweb` in the examples is the directory you ran installed
411 gitweb in, and contains `gitweb_config.perl`.
413 If you've configured a web server that isn't listed here for gitweb, please send
414 in the instructions so they can be included in a future release.
416 Apache as CGI
417 ~~~~~~~~~~~~~
418 Apache must be configured to support CGI scripts in the directory in
419 which gitweb is installed.  Let's assume that it is '/var/www/cgi-bin'
420 directory.
422 -----------------------------------------------------------------------
423 ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
425 <Directory "/var/www/cgi-bin">
426     Options Indexes FollowSymlinks ExecCGI
427     AllowOverride None
428     Order allow,deny
429     Allow from all
430 </Directory>
431 -----------------------------------------------------------------------
433 With that configuration the full path to browse repositories would be:
435   http://server/cgi-bin/gitweb.cgi
437 Apache with mod_perl, via ModPerl::Registry
438 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
439 You can use mod_perl with gitweb.  You must install Apache::Registry
440 (for mod_perl 1.x) or ModPerl::Registry (for mod_perl 2.x) to enable
441 this support.
443 Assuming that gitweb is installed to '/var/www/perl', the following
444 Apache configuration (for mod_perl 2.x) is suitable.
446 -----------------------------------------------------------------------
447 Alias /perl "/var/www/perl"
449 <Directory "/var/www/perl">
450     SetHandler perl-script
451     PerlResponseHandler ModPerl::Registry
452     PerlOptions +ParseHeaders
453     Options Indexes FollowSymlinks +ExecCGI
454     AllowOverride None
455     Order allow,deny
456     Allow from all
457 </Directory>
458 -----------------------------------------------------------------------
460 With that configuration the full path to browse repositories would be:
462   http://server/perl/gitweb.cgi
464 Apache with FastCGI
465 ~~~~~~~~~~~~~~~~~~~
466 Gitweb works with Apache and FastCGI.  First you need to rename, copy
467 or symlink gitweb.cgi to gitweb.fcgi.  Let's assume that gitweb is
468 installed in '/usr/share/gitweb' directory.  The following Apache
469 configuration is suitable (UNTESTED!)
471 -----------------------------------------------------------------------
472 FastCgiServer /usr/share/gitweb/gitweb.cgi
473 ScriptAlias /gitweb /usr/share/gitweb/gitweb.cgi
475 Alias /gitweb/static /usr/share/gitweb/static
476 <Directory /usr/share/gitweb/static>
477     SetHandler default-handler
478 </Directory>
479 -----------------------------------------------------------------------
481 With that configuration the full path to browse repositories would be:
483   http://server/gitweb
486 ADVANCED WEB SERVER SETUP
487 -------------------------
488 All of those examples use request rewriting, and need `mod_rewrite`
489 (or equivalent; examples below are written for Apache).
491 Single URL for gitweb and for fetching
492 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
493 If you want to have one URL for both gitweb and your `http://`
494 repositories, you can configure Apache like this:
496 -----------------------------------------------------------------------
497 <VirtualHost *:80>
498     ServerName    git.example.org
499     DocumentRoot  /pub/git
500     SetEnv        GITWEB_CONFIG   /etc/gitweb.conf
502     # turning on mod rewrite
503     RewriteEngine on
505     # make the front page an internal rewrite to the gitweb script
506     RewriteRule ^/$  /cgi-bin/gitweb.cgi
508     # make access for "dumb clients" work
509     RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ \
510                 /cgi-bin/gitweb.cgi%{REQUEST_URI}  [L,PT]
511 </VirtualHost>
512 -----------------------------------------------------------------------
514 The above configuration expects your public repositories to live under
515 '/pub/git' and will serve them as `http://git.domain.org/dir-under-pub-git`,
516 both as clonable Git URL and as browseable gitweb interface.  If you then
517 start your linkgit:git-daemon[1] with `--base-path=/pub/git --export-all`
518 then you can even use the `git://` URL with exactly the same path.
520 Setting the environment variable `GITWEB_CONFIG` will tell gitweb to use the
521 named file (i.e. in this example '/etc/gitweb.conf') as a configuration for
522 gitweb.  You don't really need it in above example; it is required only if
523 your configuration file is in different place than built-in (during
524 compiling gitweb) 'gitweb_config.perl' or '/etc/gitweb.conf'.  See
525 linkgit:gitweb.conf[5] for details, especially information about precedence
526 rules.
528 If you use the rewrite rules from the example you *might* also need
529 something like the following in your gitweb configuration file
530 ('/etc/gitweb.conf' following example):
531 ----------------------------------------------------------------------------
532 @stylesheets = ("/some/absolute/path/gitweb.css");
533 $my_uri    = "/";
534 $home_link = "/";
535 $per_request_config = 1;
536 ----------------------------------------------------------------------------
537 Nowadays though gitweb should create HTML base tag when needed (to set base
538 URI for relative links), so it should work automatically.
541 Webserver configuration with multiple projects' root
542 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
543 If you want to use gitweb with several project roots you can edit your
544 Apache virtual host and gitweb configuration files in the following way.
546 The virtual host configuration (in Apache configuration file) should look
547 like this:
548 --------------------------------------------------------------------------
549 <VirtualHost *:80>
550     ServerName    git.example.org
551     DocumentRoot  /pub/git
552     SetEnv        GITWEB_CONFIG  /etc/gitweb.conf
554     # turning on mod rewrite
555     RewriteEngine on
557     # make the front page an internal rewrite to the gitweb script
558     RewriteRule ^/$  /cgi-bin/gitweb.cgi  [QSA,L,PT]
560     # look for a public_git folder in unix users' home
561     # http://git.example.org/~<user>/
562     RewriteRule ^/\~([^\/]+)(/|/gitweb.cgi)?$   /cgi-bin/gitweb.cgi \
563                 [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
565     # http://git.example.org/+<user>/
566     #RewriteRule ^/\+([^\/]+)(/|/gitweb.cgi)?$  /cgi-bin/gitweb.cgi \
567                  [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
569     # http://git.example.org/user/<user>/
570     #RewriteRule ^/user/([^\/]+)/(gitweb.cgi)?$ /cgi-bin/gitweb.cgi \
571                  [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT]
573     # defined list of project roots
574     RewriteRule ^/scm(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \
575                 [QSA,E=GITWEB_PROJECTROOT:/pub/scm/,L,PT]
576     RewriteRule ^/var(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \
577                 [QSA,E=GITWEB_PROJECTROOT:/var/git/,L,PT]
579     # make access for "dumb clients" work
580     RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ \
581                 /cgi-bin/gitweb.cgi%{REQUEST_URI}  [L,PT]
582 </VirtualHost>
583 --------------------------------------------------------------------------
585 Here actual project root is passed to gitweb via `GITWEB_PROJECT_ROOT`
586 environment variable from a web server, so you need to put the following
587 line in gitweb configuration file ('/etc/gitweb.conf' in above example):
588 --------------------------------------------------------------------------
589 $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/pub/git";
590 --------------------------------------------------------------------------
591 *Note* that this requires to be set for each request, so either
592 `$per_request_config` must be false, or the above must be put in code
593 referenced by `$per_request_config`;
595 These configurations enable two things. First, each unix user (`<user>`) of
596 the server will be able to browse through gitweb Git repositories found in
597 '~/public_git/' with the following url:
599   http://git.example.org/~<user>/
601 If you do not want this feature on your server just remove the second
602 rewrite rule.
604 If you already use `mod_userdir` in your virtual host or you don't want to
605 use the \'~' as first character, just comment or remove the second rewrite
606 rule, and uncomment one of the following according to what you want.
608 Second, repositories found in '/pub/scm/' and '/var/git/' will be accessible
609 through `http://git.example.org/scm/` and `http://git.example.org/var/`.
610 You can add as many project roots as you want by adding rewrite rules like
611 the third and the fourth.
614 PATH_INFO usage
615 ~~~~~~~~~~~~~~~
616 If you enable PATH_INFO usage in gitweb by putting
617 ----------------------------------------------------------------------------
618 $feature{'pathinfo'}{'default'} = [1];
619 ----------------------------------------------------------------------------
620 in your gitweb configuration file, it is possible to set up your server so
621 that it consumes and produces URLs in the form
623   http://git.example.com/project.git/shortlog/sometag
625 i.e. without 'gitweb.cgi' part, by using a configuration such as the
626 following.  This configuration assumes that '/var/www/gitweb' is the
627 DocumentRoot of your webserver, contains the gitweb.cgi script and
628 complementary static files (stylesheet, favicon, JavaScript):
630 ----------------------------------------------------------------------------
631 <VirtualHost *:80>
632         ServerAlias git.example.com
634         DocumentRoot /var/www/gitweb
636         <Directory /var/www/gitweb>
637                 Options ExecCGI
638                 AddHandler cgi-script cgi
640                 DirectoryIndex gitweb.cgi
642                 RewriteEngine On
643                 RewriteCond %{REQUEST_FILENAME} !-f
644                 RewriteCond %{REQUEST_FILENAME} !-d
645                 RewriteRule ^.* /gitweb.cgi/$0 [L,PT]
646         </Directory>
647 </VirtualHost>
648 ----------------------------------------------------------------------------
649 The rewrite rule guarantees that existing static files will be properly
650 served, whereas any other URL will be passed to gitweb as PATH_INFO
651 parameter.
653 *Notice* that in this case you don't need special settings for
654 `@stylesheets`, `$my_uri` and `$home_link`, but you lose "dumb client"
655 access to your project .git dirs (described in "Single URL for gitweb and
656 for fetching" section).  A possible workaround for the latter is the
657 following: in your project root dir (e.g. '/pub/git') have the projects
658 named *without* a .git extension (e.g. '/pub/git/project' instead of
659 '/pub/git/project.git') and configure Apache as follows:
660 ----------------------------------------------------------------------------
661 <VirtualHost *:80>
662         ServerAlias git.example.com
664         DocumentRoot /var/www/gitweb
666         AliasMatch ^(/.*?)(\.git)(/.*)?$ /pub/git$1$3
667         <Directory /var/www/gitweb>
668                 Options ExecCGI
669                 AddHandler cgi-script cgi
671                 DirectoryIndex gitweb.cgi
673                 RewriteEngine On
674                 RewriteCond %{REQUEST_FILENAME} !-f
675                 RewriteCond %{REQUEST_FILENAME} !-d
676                 RewriteRule ^.* /gitweb.cgi/$0 [L,PT]
677         </Directory>
678 </VirtualHost>
679 ----------------------------------------------------------------------------
681 The additional AliasMatch makes it so that
683   http://git.example.com/project.git
685 will give raw access to the project's Git dir (so that the project can be
686 cloned), while
688   http://git.example.com/project
690 will provide human-friendly gitweb access.
692 This solution is not 100% bulletproof, in the sense that if some project has
693 a named ref (branch, tag) starting with 'git/', then paths such as
695   http://git.example.com/project/command/abranch..git/abranch
697 will fail with a 404 error.
700 BUGS
701 ----
702 Please report any bugs or feature requests to git@vger.kernel.org,
703 putting "gitweb" in the subject of email.
705 SEE ALSO
706 --------
707 linkgit:gitweb.conf[5], linkgit:git-instaweb[1]
709 'gitweb/README', 'gitweb/INSTALL'
713 Part of the linkgit:git[1] suite