blob: 35d5c0d7e5e4df54486d3a464a491eaade37690e [file] [log] [blame]
Shawn O. Pearcee31d02c2009-12-08 12:21:37 -08001Gerrit Code Review - Gitweb Integration
2=======================================
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08003
Shawn O. Pearce618dae22010-03-12 19:07:43 -08004Gerrit Code Review can manage and generate hyperlinks to gitweb,
5allowing users to jump from Gerrit content to the same information,
6but shown by gitweb.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08007
Shawn O. Pearce618dae22010-03-12 19:07:43 -08008
9Internal/Managed gitweb
10-----------------------
11
12In the internal configuration, Gerrit inspects the request, enforces
13its project level access controls, and directly executes `gitweb.cgi`
14if the user is authorized to view the page.
15
16To enable the internal configuration, set
17link:config-gerrit.html#gitweb.cgi[gitweb.cgi] with the path of the
18installed CGI. This defaults to `/usr/lib/cgi-bin/gitweb.cgi`,
19which is a common installation path for the 'gitweb' package on
20Linux distributions.
21
22====
23 git config --file $site_path/etc/gerrit.config gitweb.cgi /usr/lib/cgi-bin/gitweb.cgi
Piotr Sikora6a9d47e2011-02-27 21:22:32 +000024 git config --file $site_path/etc/gerrit.config --unset gitweb.url
25====
26
27Alternatively, if Gerrit is served behind reverse proxy, it can
28generate different URLs for gitweb's links (they need to be
29rewritten to `<gerrit>/gitweb?args` on the web server). This allows
David Pursehouse221d4f62012-06-08 17:38:08 +090030for serving gitweb under a different URL than the Gerrit instance.
Piotr Sikora6a9d47e2011-02-27 21:22:32 +000031To enable this feature, set both: `gitweb.cgi` and `gitweb.url`.
32
33====
34 git config --file $site_path/etc/gerrit.config gitweb.cgi /usr/lib/cgi-bin/gitweb.cgi
35 git config --file $site_path/etc/gerrit.config gitweb.url /pretty/path/to/gitweb
Shawn O. Pearce618dae22010-03-12 19:07:43 -080036====
37
38After updating `'$site_path'/etc/gerrit.config`, the Gerrit server must
39be restarted and clients must reload the host page to see the change.
40
Shawn O. Pearce544220c2010-03-13 17:39:35 -080041Configuration
42~~~~~~~~~~~~~
43
44Most of the gitweb configuration file is handled automatically
45by Gerrit Code Review. Site specific overrides can be placed in
46`'$site_path'/etc/gitweb_config.perl`, as this file is loaded as
47part of the generated configuration file.
48
Shawn O. Pearcea57697b2010-03-13 18:23:47 -080049Logo and CSS
50~~~~~~~~~~~~
51
52If the package-manager installed CGI (`/usr/lib/cgi-bin/gitweb.cgi`)
53is being used, the stock CSS and logo files will be served from
54either `/usr/share/gitweb` or `/var/www`.
55
56Otherwise, Gerrit expects `gitweb.css` and `git-logo.png` to be found
57in the same directory as the CGI script itself. This matches with
58the default source code distribution, and most custom installations.
59
Shawn O. Pearce618dae22010-03-12 19:07:43 -080060Access Control
61~~~~~~~~~~~~~~
62
63Access controls for internally managed gitweb page views are enforced
64using the standard project READ +1 permission.
65
66
67External/Unmanaged gitweb
68-------------------------
69
70In the external configuration, gitweb runs under the control of an
71external web server, and Gerrit access controls are not enforced.
72
73To enable the external gitweb integration, set
74link:config-gerrit.html#gitweb.url[gitweb.url] with the URL of your
75gitweb CGI.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080076
Shawn O. Pearce9743d0b2009-06-01 10:10:06 -070077The CGI's `$projectroot` should be the same directory as
78gerrit.basePath, or a fairly current replica. If a replica is
79being used, ensure it uses a full mirror, so the `refs/changes/*`
80namespace is available.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080081
82====
Shawn O. Pearcec5fed822009-11-17 16:10:10 -080083 git config --file $site_path/etc/gerrit.config gitweb.url http://example.com/gitweb.cgi
Piotr Sikora6a9d47e2011-02-27 21:22:32 +000084 git config --file $site_path/etc/gerrit.config --unset gitweb.cgi
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080085====
86
Shawn O. Pearcec5fed822009-11-17 16:10:10 -080087After updating `'$site_path'/etc/gerrit.config`, the Gerrit server must
Shawn O. Pearced7ba11f2009-06-01 09:35:41 -070088be restarted and clients must reload the host page to see the change.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080089
90Access Control
Shawn O. Pearce618dae22010-03-12 19:07:43 -080091~~~~~~~~~~~~~~
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080092
93Gitweb access controls can be implemented using standard web server
94access controls. This isn't typically integrated with Gerrit's own
95access controls. Caution must be taken to ensure the controls are
96consistent if access needs to be restricted.
97
98Caching Gitweb
Shawn O. Pearce618dae22010-03-12 19:07:43 -080099~~~~~~~~~~~~~~
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800100
101If your repository set is large and you are expecting a lot
102of users, you may want to look at the caching forks used by
103high-traffic sites like kernel.org or repo.or.cz.
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700104
Shane Mc Cormack27868a42009-12-28 04:49:39 +0000105Alternatives to gitweb
Shawn O. Pearce618dae22010-03-12 19:07:43 -0800106~~~~~~~~~~~~~~~~~~~~~~
Shane Mc Cormack27868a42009-12-28 04:49:39 +0000107There are other alternatives to gitweb that can also be used with
108Gerrit, such as cgit.
109
110cgit can be used by specifying `gitweb.type` to be 'cgit'.
111
112It is also possible to define custom patterns.
113
Shawn O. Pearced7ba11f2009-06-01 09:35:41 -0700114See Also
115--------
116
Shawn O. Pearce8efb2a72009-08-18 19:45:33 -0700117* link:config-gerrit.html#gitweb[Section gitweb]
Shane Mc Cormack27868a42009-12-28 04:49:39 +0000118* link:http://hjemli.net/git/cgit/[cgit]
Shawn O. Pearced7ba11f2009-06-01 09:35:41 -0700119
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700120GERRIT
121------
122Part of link:index.html[Gerrit Code Review]