Shawn O. Pearce | e31d02c | 2009-12-08 12:21:37 -0800 | [diff] [blame] | 1 | Gerrit Code Review - Gitweb Integration |
| 2 | ======================================= |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 3 | |
Shawn O. Pearce | 618dae2 | 2010-03-12 19:07:43 -0800 | [diff] [blame] | 4 | Gerrit Code Review can manage and generate hyperlinks to gitweb, |
| 5 | allowing users to jump from Gerrit content to the same information, |
| 6 | but shown by gitweb. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 7 | |
Shawn O. Pearce | 618dae2 | 2010-03-12 19:07:43 -0800 | [diff] [blame] | 8 | |
| 9 | Internal/Managed gitweb |
| 10 | ----------------------- |
| 11 | |
| 12 | In the internal configuration, Gerrit inspects the request, enforces |
| 13 | its project level access controls, and directly executes `gitweb.cgi` |
| 14 | if the user is authorized to view the page. |
| 15 | |
| 16 | To enable the internal configuration, set |
| 17 | link:config-gerrit.html#gitweb.cgi[gitweb.cgi] with the path of the |
| 18 | installed CGI. This defaults to `/usr/lib/cgi-bin/gitweb.cgi`, |
| 19 | which is a common installation path for the 'gitweb' package on |
| 20 | Linux distributions. |
| 21 | |
| 22 | ==== |
| 23 | git config --file $site_path/etc/gerrit.config gitweb.cgi /usr/lib/cgi-bin/gitweb.cgi |
Piotr Sikora | 6a9d47e | 2011-02-27 21:22:32 +0000 | [diff] [blame] | 24 | git config --file $site_path/etc/gerrit.config --unset gitweb.url |
| 25 | ==== |
| 26 | |
| 27 | Alternatively, if Gerrit is served behind reverse proxy, it can |
| 28 | generate different URLs for gitweb's links (they need to be |
| 29 | rewritten to `<gerrit>/gitweb?args` on the web server). This allows |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame^] | 30 | for serving gitweb under a different URL than the Gerrit instance. |
Piotr Sikora | 6a9d47e | 2011-02-27 21:22:32 +0000 | [diff] [blame] | 31 | To 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. Pearce | 618dae2 | 2010-03-12 19:07:43 -0800 | [diff] [blame] | 36 | ==== |
| 37 | |
| 38 | After updating `'$site_path'/etc/gerrit.config`, the Gerrit server must |
| 39 | be restarted and clients must reload the host page to see the change. |
| 40 | |
Shawn O. Pearce | 544220c | 2010-03-13 17:39:35 -0800 | [diff] [blame] | 41 | Configuration |
| 42 | ~~~~~~~~~~~~~ |
| 43 | |
| 44 | Most of the gitweb configuration file is handled automatically |
| 45 | by Gerrit Code Review. Site specific overrides can be placed in |
| 46 | `'$site_path'/etc/gitweb_config.perl`, as this file is loaded as |
| 47 | part of the generated configuration file. |
| 48 | |
Shawn O. Pearce | a57697b | 2010-03-13 18:23:47 -0800 | [diff] [blame] | 49 | Logo and CSS |
| 50 | ~~~~~~~~~~~~ |
| 51 | |
| 52 | If the package-manager installed CGI (`/usr/lib/cgi-bin/gitweb.cgi`) |
| 53 | is being used, the stock CSS and logo files will be served from |
| 54 | either `/usr/share/gitweb` or `/var/www`. |
| 55 | |
| 56 | Otherwise, Gerrit expects `gitweb.css` and `git-logo.png` to be found |
| 57 | in the same directory as the CGI script itself. This matches with |
| 58 | the default source code distribution, and most custom installations. |
| 59 | |
Shawn O. Pearce | 618dae2 | 2010-03-12 19:07:43 -0800 | [diff] [blame] | 60 | Access Control |
| 61 | ~~~~~~~~~~~~~~ |
| 62 | |
| 63 | Access controls for internally managed gitweb page views are enforced |
| 64 | using the standard project READ +1 permission. |
| 65 | |
| 66 | |
| 67 | External/Unmanaged gitweb |
| 68 | ------------------------- |
| 69 | |
| 70 | In the external configuration, gitweb runs under the control of an |
| 71 | external web server, and Gerrit access controls are not enforced. |
| 72 | |
| 73 | To enable the external gitweb integration, set |
| 74 | link:config-gerrit.html#gitweb.url[gitweb.url] with the URL of your |
| 75 | gitweb CGI. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 76 | |
Shawn O. Pearce | 9743d0b | 2009-06-01 10:10:06 -0700 | [diff] [blame] | 77 | The CGI's `$projectroot` should be the same directory as |
| 78 | gerrit.basePath, or a fairly current replica. If a replica is |
| 79 | being used, ensure it uses a full mirror, so the `refs/changes/*` |
| 80 | namespace is available. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 81 | |
| 82 | ==== |
Shawn O. Pearce | c5fed82 | 2009-11-17 16:10:10 -0800 | [diff] [blame] | 83 | git config --file $site_path/etc/gerrit.config gitweb.url http://example.com/gitweb.cgi |
Piotr Sikora | 6a9d47e | 2011-02-27 21:22:32 +0000 | [diff] [blame] | 84 | git config --file $site_path/etc/gerrit.config --unset gitweb.cgi |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 85 | ==== |
| 86 | |
Shawn O. Pearce | c5fed82 | 2009-11-17 16:10:10 -0800 | [diff] [blame] | 87 | After updating `'$site_path'/etc/gerrit.config`, the Gerrit server must |
Shawn O. Pearce | d7ba11f | 2009-06-01 09:35:41 -0700 | [diff] [blame] | 88 | be restarted and clients must reload the host page to see the change. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 89 | |
| 90 | Access Control |
Shawn O. Pearce | 618dae2 | 2010-03-12 19:07:43 -0800 | [diff] [blame] | 91 | ~~~~~~~~~~~~~~ |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 92 | |
| 93 | Gitweb access controls can be implemented using standard web server |
| 94 | access controls. This isn't typically integrated with Gerrit's own |
| 95 | access controls. Caution must be taken to ensure the controls are |
| 96 | consistent if access needs to be restricted. |
| 97 | |
| 98 | Caching Gitweb |
Shawn O. Pearce | 618dae2 | 2010-03-12 19:07:43 -0800 | [diff] [blame] | 99 | ~~~~~~~~~~~~~~ |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 100 | |
| 101 | If your repository set is large and you are expecting a lot |
| 102 | of users, you may want to look at the caching forks used by |
| 103 | high-traffic sites like kernel.org or repo.or.cz. |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 104 | |
Shane Mc Cormack | 27868a4 | 2009-12-28 04:49:39 +0000 | [diff] [blame] | 105 | Alternatives to gitweb |
Shawn O. Pearce | 618dae2 | 2010-03-12 19:07:43 -0800 | [diff] [blame] | 106 | ~~~~~~~~~~~~~~~~~~~~~~ |
Shane Mc Cormack | 27868a4 | 2009-12-28 04:49:39 +0000 | [diff] [blame] | 107 | There are other alternatives to gitweb that can also be used with |
| 108 | Gerrit, such as cgit. |
| 109 | |
| 110 | cgit can be used by specifying `gitweb.type` to be 'cgit'. |
| 111 | |
| 112 | It is also possible to define custom patterns. |
| 113 | |
Shawn O. Pearce | d7ba11f | 2009-06-01 09:35:41 -0700 | [diff] [blame] | 114 | See Also |
| 115 | -------- |
| 116 | |
Shawn O. Pearce | 8efb2a7 | 2009-08-18 19:45:33 -0700 | [diff] [blame] | 117 | * link:config-gerrit.html#gitweb[Section gitweb] |
Shane Mc Cormack | 27868a4 | 2009-12-28 04:49:39 +0000 | [diff] [blame] | 118 | * link:http://hjemli.net/git/cgit/[cgit] |
Shawn O. Pearce | d7ba11f | 2009-06-01 09:35:41 -0700 | [diff] [blame] | 119 | |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 120 | GERRIT |
| 121 | ------ |
| 122 | Part of link:index.html[Gerrit Code Review] |