Commit | Line | Data |
---|---|---|
cd67c8e0 JN |
1 | GIT web Interface (gitweb) Installation |
2 | ======================================= | |
3 | ||
4 | First you have to generate gitweb.cgi from gitweb.perl using | |
18d05328 PKS |
5 | "make gitweb", then "make install-gitweb" appropriate files |
6 | (gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png) | |
7 | to their destination. For example if git was (or is) installed with | |
8 | /usr prefix and gitwebdir is /var/www/cgi-bin, you can do | |
cd67c8e0 | 9 | |
152d9434 JN |
10 | $ make prefix=/usr gitweb ;# as yourself |
11 | # make gitwebdir=/var/www/cgi-bin install-gitweb ;# as root | |
cd67c8e0 JN |
12 | |
13 | Alternatively you can use autoconf generated ./configure script to | |
14 | set up path to git binaries (via config.mak.autogen), so you can write | |
15 | instead | |
16 | ||
17 | $ make configure ;# as yourself | |
18 | $ ./configure --prefix=/usr ;# as yourself | |
e3918594 | 19 | $ make gitweb ;# as yourself |
152d9434 JN |
20 | # make gitwebdir=/var/www/cgi-bin \ |
21 | install-gitweb ;# as root | |
cd67c8e0 JN |
22 | |
23 | The above example assumes that your web server is configured to run | |
24 | [executable] files in /var/www/cgi-bin/ as server scripts (as CGI | |
25 | scripts). | |
26 | ||
27 | ||
80b4dfee JN |
28 | Requirements |
29 | ------------ | |
30 | ||
31 | - Core git tools | |
32 | - Perl | |
33 | - Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename. | |
34 | - web server | |
35 | ||
36 | The following optional Perl modules are required for extra features | |
37 | - Digest::MD5 - for gravatar support | |
38 | - CGI::Fast and FCGI - for running gitweb as FastCGI script | |
39 | - HTML::TagCloud - for fancy tag cloud in project list view | |
40 | - HTTP::Date or Time::ParseDate - to support If-Modified-Since for feeds | |
41 | ||
42 | ||
cd67c8e0 JN |
43 | Build time configuration |
44 | ------------------------ | |
45 | ||
cee694d0 | 46 | See also "How to configure gitweb for your local system" section below. |
cd67c8e0 | 47 | |
eae7a759 | 48 | - There are many configuration variables which affect building of |
cd67c8e0 | 49 | gitweb.cgi; see "default configuration for gitweb" section in main |
e3918594 | 50 | (top dir) Makefile, and instructions for building gitweb target. |
cd67c8e0 | 51 | |
eae7a759 RGS |
52 | One of the most important is where to find the git wrapper binary. Gitweb |
53 | tries to find the git wrapper at $(bindir)/git, so you have to set $bindir | |
cd67c8e0 | 54 | when building gitweb.cgi, or $prefix from which $bindir is derived. If |
eae7a759 | 55 | you build and install gitweb together with the rest of the git suite, |
cd67c8e0 JN |
56 | there should be no problems. Otherwise, if git was for example |
57 | installed from a binary package, you have to set $prefix (or $bindir) | |
58 | accordingly. | |
59 | ||
60 | - Another important issue is where are git repositories you want to make | |
eae7a759 | 61 | available to gitweb. By default gitweb searches for repositories under |
cd67c8e0 JN |
62 | /pub/git; if you want to have projects somewhere else, like /home/git, |
63 | use GITWEB_PROJECTROOT build configuration variable. | |
64 | ||
65 | By default all git repositories under projectroot are visible and | |
eae7a759 | 66 | available to gitweb. The list of projects is generated by default by |
cd67c8e0 JN |
67 | scanning the projectroot directory for git repositories. This can be |
68 | changed (configured) as described in "Gitweb repositories" section | |
69 | below. | |
70 | ||
eae7a759 RGS |
71 | Note that gitweb deals directly with the object database, and does not |
72 | need a working directory; the name of the project is the name of its | |
cd67c8e0 JN |
73 | repository object database, usually projectname.git for bare |
74 | repositories. If you want to provide gitweb access to non-bare (live) | |
eae7a759 | 75 | repositories, you can make projectname.git a symbolic link under |
cd67c8e0 JN |
76 | projectroot linking to projectname/.git (but it is just |
77 | a suggestion). | |
78 | ||
79 | - You can control where gitweb tries to find its main CSS style file, | |
a8ab675f MR |
80 | its JavaScript file, its favicon and logo with the GITWEB_CSS, GITWEB_JS |
81 | GITWEB_FAVICON and GITWEB_LOGO build configuration variables. By default | |
82 | gitweb tries to find them in the same directory as gitweb.cgi script. | |
cd67c8e0 | 83 | |
a8ab675f MR |
84 | - You can optionally generate minified versions of gitweb.js and gitweb.css |
85 | by defining the JSMIN and CSSMIN build configuration variables. By default | |
86 | the non-minified versions will be used. NOTE: if you enable this option, | |
87 | substitute gitweb.min.js and gitweb.min.css for all uses of gitweb.js and | |
88 | gitweb.css in the help files. | |
0e6ce213 | 89 | |
cee694d0 JN |
90 | |
91 | How to configure gitweb for your local system | |
92 | --------------------------------------------- | |
93 | ||
94 | You can specify the following configuration variables when building GIT: | |
95 | ||
96 | * GIT_BINDIR | |
97 | Points where to find the git executable. You should set it up to | |
98 | the place where the git binary was installed (usually /usr/bin) if you | |
99 | don't install git from sources together with gitweb. [Default: $(bindir)] | |
100 | * GITWEB_SITENAME | |
101 | Shown in the title of all generated pages, defaults to the server name | |
102 | (SERVER_NAME CGI environment variable) if not set. [No default] | |
103 | * GITWEB_PROJECTROOT | |
104 | The root directory for all projects shown by gitweb. Must be set | |
105 | correctly for gitweb to find repositories to display. See also | |
106 | "Gitweb repositories" in the INSTALL file for gitweb. [Default: /pub/git] | |
107 | * GITWEB_PROJECT_MAXDEPTH | |
108 | The filesystem traversing limit for getting the project list; the number | |
109 | is taken as depth relative to the projectroot. It is used when | |
110 | GITWEB_LIST is a directory (or is not set; then project root is used). | |
111 | This is meant to speed up project listing on large work trees by limiting | |
112 | search depth. [Default: 2007] | |
113 | * GITWEB_LIST | |
114 | Points to a directory to scan for projects (defaults to project root | |
115 | if not set / if empty) or to a file with explicit listing of projects | |
116 | (together with projects' ownership). See "Generating projects list | |
117 | using gitweb" in INSTALL file for gitweb to find out how to generate | |
118 | such file from scan of a directory. [No default, which means use root | |
119 | directory for projects] | |
120 | * GITWEB_EXPORT_OK | |
121 | Show repository only if this file exists (in repository). Only | |
122 | effective if this variable evaluates to true. [No default / Not set] | |
123 | * GITWEB_STRICT_EXPORT | |
124 | Only allow viewing of repositories also shown on the overview page. | |
125 | This for example makes GITWEB_EXPORT_OK to decide if repository is | |
126 | available and not only if it is shown. If GITWEB_LIST points to | |
127 | file with list of project, only those repositories listed would be | |
128 | available for gitweb. [No default] | |
129 | * GITWEB_HOMETEXT | |
130 | Points to an .html file which is included on the gitweb project | |
131 | overview page ('projects_list' view), if it exists. Relative to | |
132 | gitweb.cgi script. [Default: indextext.html] | |
c1355b7f LH |
133 | * GITWEB_SITE_HTML_HEAD_STRING |
134 | html snippet to include in the <head> section of each page. [No default] | |
cee694d0 JN |
135 | * GITWEB_SITE_HEADER |
136 | Filename of html text to include at top of each page. Relative to | |
137 | gitweb.cgi script. [No default] | |
138 | * GITWEB_SITE_FOOTER | |
139 | Filename of html text to include at bottom of each page. Relative to | |
140 | gitweb.cgi script. [No default] | |
141 | * GITWEB_HOME_LINK_STR | |
142 | String of the home link on top of all pages, leading to $home_link | |
143 | (usually main gitweb page, which means projects list). Used as first | |
144 | part of gitweb view "breadcrumb trail": <home> / <project> / <view>. | |
145 | [Default: projects] | |
146 | * GITWEB_SITENAME | |
147 | Name of your site or organization to appear in page titles. Set it | |
148 | to something descriptive for clearer bookmarks etc. If not set | |
149 | (if empty) gitweb uses "$SERVER_NAME Git", or "Untitled Git" if | |
150 | SERVER_NAME CGI environment variable is not set (e.g. if running | |
151 | gitweb as standalone script). [No default] | |
152 | * GITWEB_BASE_URL | |
153 | Git base URLs used for URL to where fetch project from, i.e. full | |
154 | URL is "$git_base_url/$project". Shown on projects summary page. | |
155 | Repository URL for project can be also configured per repository; this | |
156 | takes precedence over URLs composed from base URL and a project name. | |
157 | Note that you can setup multiple base URLs (for example one for | |
158 | git:// protocol access, another for http:// access) from the gitweb | |
159 | config file. [No default] | |
160 | * GITWEB_CSS | |
161 | Points to the location where you put gitweb.css on your web server | |
162 | (or to be more generic, the URI of gitweb stylesheet). Relative to the | |
163 | base URI of gitweb. Note that you can setup multiple stylesheets from | |
164 | the gitweb config file. [Default: static/gitweb.css (or | |
165 | static/gitweb.min.css if the CSSMIN variable is defined / CSS minifier | |
166 | is used)] | |
560869e3 JN |
167 | * GITWEB_JS |
168 | Points to the location where you put gitweb.js on your web server | |
169 | (or to be more generic URI of JavaScript code used by gitweb). | |
170 | Relative to base URI of gitweb. [Default: static/gitweb.js (or | |
171 | static/gitweb.min.js if JSMIN build variable is defined / JavaScript | |
172 | minifier is used)] | |
173 | * CSSMIN, JSMIN | |
174 | Invocation of a CSS minifier or a JavaScript minifier, respectively, | |
175 | working as a filter (source on standard input, minified result on | |
176 | standard output). If set, it is used to generate a minified version of | |
177 | 'static/gitweb.css' or 'static/gitweb.js', respectively. *Note* that | |
178 | minified files would have *.min.css and *.min.js extension, which is | |
179 | important if you also set GITWEB_CSS and/or GITWEB_JS. [No default] | |
cee694d0 JN |
180 | * GITWEB_LOGO |
181 | Points to the location where you put git-logo.png on your web server | |
182 | (or to be more generic URI of logo, 72x27 size, displayed in top right | |
183 | corner of each gitweb page, and used as logo for Atom feed). Relative | |
184 | to base URI of gitweb. [Default: static/git-logo.png] | |
185 | * GITWEB_FAVICON | |
186 | Points to the location where you put git-favicon.png on your web server | |
187 | (or to be more generic URI of favicon, assumed to be image/png type; | |
188 | web browsers that support favicons (website icons) may display them | |
189 | in the browser's URL bar and next to site name in bookmarks). Relative | |
190 | to base URI of gitweb. [Default: static/git-favicon.png] | |
cee694d0 JN |
191 | * GITWEB_CONFIG |
192 | This Perl file will be loaded using 'do' and can be used to override any | |
193 | of the options above as well as some other options -- see the "Runtime | |
194 | gitweb configuration" section below, and top of 'gitweb.cgi' for their | |
195 | full list and description. If the environment variable GITWEB_CONFIG | |
196 | is set when gitweb.cgi is executed, then the file specified in the | |
197 | environment variable will be loaded instead of the file specified | |
198 | when gitweb.cgi was created. [Default: gitweb_config.perl] | |
199 | * GITWEB_CONFIG_SYSTEM | |
200 | This Perl file will be loaded using 'do' as a fallback if GITWEB_CONFIG | |
201 | does not exist. If the environment variable GITWEB_CONFIG_SYSTEM is set | |
202 | when gitweb.cgi is executed, then the file specified in the environment | |
203 | variable will be loaded instead of the file specified when gitweb.cgi was | |
204 | created. [Default: /etc/gitweb.conf] | |
205 | * HIGHLIGHT_BIN | |
206 | Path to the highlight executable to use (must be the one from | |
207 | http://www.andre-simon.de due to assumptions about parameters and output). | |
208 | Useful if highlight is not installed on your webserver's PATH. | |
209 | [Default: highlight] | |
210 | ||
cd67c8e0 JN |
211 | Build example |
212 | ~~~~~~~~~~~~~ | |
213 | ||
8515392f JN |
214 | - To install gitweb to /var/www/cgi-bin/gitweb/, when git wrapper |
215 | is installed at /usr/local/bin/git, the repositories (projects) | |
216 | we want to display are under /home/local/scm, and you do not use | |
217 | minifiers, you can do | |
cd67c8e0 JN |
218 | |
219 | make GITWEB_PROJECTROOT="/home/local/scm" \ | |
18d05328 PKS |
220 | GITWEB_JS="gitweb/static/gitweb.js" \ |
221 | GITWEB_CSS="gitweb/static/gitweb.css" \ | |
222 | GITWEB_LOGO="gitweb/static/git-logo.png" \ | |
223 | GITWEB_FAVICON="gitweb/static/git-favicon.png" \ | |
cd67c8e0 | 224 | bindir=/usr/local/bin \ |
e3918594 | 225 | gitweb |
cd67c8e0 | 226 | |
18d05328 | 227 | make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb |
cd67c8e0 JN |
228 | |
229 | ||
230 | Gitweb config file | |
231 | ------------------ | |
232 | ||
233 | See also "Runtime gitweb configuration" section in README file | |
07ea4df2 | 234 | for gitweb (in gitweb/README), and gitweb.conf(5) manpage. |
cd67c8e0 | 235 | |
131d6afc | 236 | - You can configure gitweb further using the per-instance gitweb configuration file; |
eae7a759 RGS |
237 | by default this is a file named gitweb_config.perl in the same place as |
238 | gitweb.cgi script. You can control the default place for the config file | |
239 | using the GITWEB_CONFIG build configuration variable, and you can set it | |
240 | using the GITWEB_CONFIG environment variable. If this file does not | |
17a8b250 GP |
241 | exist, gitweb looks for a system-wide configuration file, normally |
242 | /etc/gitweb.conf. You can change the default using the | |
243 | GITWEB_CONFIG_SYSTEM build configuration variable, and override it | |
eae7a759 | 244 | through the GITWEB_CONFIG_SYSTEM environment variable. |
cd67c8e0 | 245 | |
0d2f7d1c JN |
246 | Note that the GITWEB_CONFIG_SYSTEM system-wide configuration file is |
247 | only used for instances that lack per-instance configuration file. | |
248 | You can use GITWEB_CONFIG_COMMON common system-wide configuration | |
249 | file (normally /etc/gitweb-common.conf) to keep common default | |
250 | settings that apply to all instances. Settings from per-instance or | |
131d6afc JN |
251 | system-wide configuration file override those from common system-wide |
252 | configuration file. | |
253 | ||
eae7a759 | 254 | - The gitweb config file is a fragment of perl code. You can set variables |
cd67c8e0 JN |
255 | using "our $variable = value"; text from "#" character until the end |
256 | of a line is ignored. See perlsyn(1) for details. | |
257 | ||
258 | See the top of gitweb.perl file for examples of customizable options. | |
259 | ||
52c813f2 JN |
260 | Config file example |
261 | ~~~~~~~~~~~~~~~~~~~ | |
cd67c8e0 | 262 | |
52c813f2 JN |
263 | To enable blame, pickaxe search, and snapshot support, while allowing |
264 | individual projects to turn them off, put the following in your | |
265 | GITWEB_CONFIG file: | |
266 | ||
267 | $feature{'blame'}{'default'} = [1]; | |
268 | $feature{'blame'}{'override'} = 1; | |
269 | ||
270 | $feature{'pickaxe'}{'default'} = [1]; | |
271 | $feature{'pickaxe'}{'override'} = 1; | |
272 | ||
1e3a2eb6 | 273 | $feature{'snapshot'}{'default'} = ['zip', 'tgz']; |
52c813f2 JN |
274 | $feature{'snapshot'}{'override'} = 1; |
275 | ||
b4c07792 MR |
276 | If you allow overriding for the snapshot feature, you can specify which |
277 | snapshot formats are globally disabled. You can also add any command line | |
278 | options you want (such as setting the compression level). For instance, | |
279 | you can disable Zip compressed snapshots and set GZip to run at level 6 by | |
280 | adding the following lines to your $GITWEB_CONFIG: | |
281 | ||
282 | $known_snapshot_formats{'zip'}{'disabled'} = 1; | |
283 | $known_snapshot_formats{'tgz'}{'compressor'} = ['gzip','-6']; | |
284 | ||
52c813f2 JN |
285 | |
286 | Gitweb repositories | |
287 | ------------------- | |
cd67c8e0 | 288 | |
07ea4df2 JN |
289 | By default gitweb shows all git repositories under single common repository |
290 | root on a local filesystem; see description of GITWEB_PROJECTROOT build-time | |
291 | configuration variable above (and also of GITWEB_LIST). | |
292 | ||
293 | More advanced usage, like limiting access or visibility of repositories and | |
294 | managing multiple roots are described on gitweb manpage. | |
52c813f2 | 295 | |
cd67c8e0 | 296 | |
cd67c8e0 JN |
297 | Example web server configuration |
298 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
299 | ||
07ea4df2 JN |
300 | See also "Webserver configuration" and "Advanced web server setup" sections |
301 | in gitweb(1) manpage. | |
cd67c8e0 JN |
302 | |
303 | ||
304 | - Apache2, gitweb installed as CGI script, | |
305 | under /var/www/cgi-bin/ | |
306 | ||
307 | ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" | |
308 | ||
309 | <Directory "/var/www/cgi-bin"> | |
310 | Options Indexes FollowSymlinks ExecCGI | |
311 | AllowOverride None | |
312 | Order allow,deny | |
313 | Allow from all | |
314 | </Directory> | |
315 | ||
316 | - Apache2, gitweb installed as mod_perl legacy script, | |
317 | under /var/www/perl/ | |
318 | ||
319 | Alias /perl "/var/www/perl" | |
320 | ||
321 | <Directory "/var/www/perl"> | |
322 | SetHandler perl-script | |
323 | PerlResponseHandler ModPerl::Registry | |
324 | PerlOptions +ParseHeaders | |
325 | Options Indexes FollowSymlinks +ExecCGI | |
326 | AllowOverride None | |
327 | Order allow,deny | |
328 | Allow from all | |
329 | </Directory> |