7 From the git version 1.4.0 gitweb is bundled with git.
10 How to configure gitweb for your local system
11 ---------------------------------------------
13 See also the "Build time configuration" section in the INSTALL
14 file for gitweb (in gitweb/INSTALL).
16 You can specify the following configuration variables when building GIT:
18 Points where to find the git executable. You should set it up to
19 the place where the git binary was installed (usually /usr/bin) if you
20 don't install git from sources together with gitweb. [Default: $(bindir)]
22 Shown in the title of all generated pages, defaults to the server name
23 (SERVER_NAME CGI environment variable) if not set. [No default]
25 The root directory for all projects shown by gitweb. Must be set
26 correctly for gitweb to find repositories to display. See also
27 "Gitweb repositories" in the INSTALL file for gitweb. [Default: /pub/git]
28 * GITWEB_PROJECT_MAXDEPTH
29 The filesystem traversing limit for getting the project list; the number
30 is taken as depth relative to the projectroot. It is used when
31 GITWEB_LIST is a directory (or is not set; then project root is used).
32 Is is meant to speed up project listing on large work trees by limiting
33 search depth. [Default: 2007]
35 Points to a directory to scan for projects (defaults to project root
36 if not set / if empty) or to a file with explicit listing of projects
37 (together with projects' ownership). See "Generating projects list
38 using gitweb" in INSTALL file for gitweb to find out how to generate
39 such file from scan of a directory. [No default, which means use root
40 directory for projects]
42 Show repository only if this file exists (in repository). Only
43 effective if this variable evaluates to true. [No default / Not set]
44 * GITWEB_STRICT_EXPORT
45 Only allow viewing of repositories also shown on the overview page.
46 This for example makes GITWEB_EXPORT_OK to decide if repository is
47 available and not only if it is shown. If GITWEB_LIST points to
48 file with list of project, only those repositories listed would be
49 available for gitweb. [No default]
51 Points to an .html file which is included on the gitweb project
52 overview page ('projects_list' view), if it exists. Relative to
53 gitweb.cgi script. [Default: indextext.html]
55 Filename of html text to include at top of each page. Relative to
56 gitweb.cgi script. [No default]
58 Filename of html text to include at bottom of each page. Relative to
59 gitweb.cgi script. [No default]
60 * GITWEB_HOME_LINK_STR
61 String of the home link on top of all pages, leading to $home_link
62 (usually main gitweb page, which means projects list). Used as first
63 part of gitweb view "breadcrumb trail": <home> / <project> / <view>.
66 Name of your site or organization to appear in page titles. Set it
67 to something descriptive for clearer bookmarks etc. If not set
68 (if empty) gitweb uses "$SERVER_NAME Git", or "Untitled Git" if
69 SERVER_NAME CGI environment variable is not set (e.g. if running
70 gitweb as standalone script). [No default]
72 Git base URLs used for URL to where fetch project from, i.e. full
73 URL is "$git_base_url/$project". Shown on projects summary page.
74 Repository URL for project can be also configured per repository; this
75 takes precedence over URLs composed from base URL and a project name.
76 Note that you can setup multiple base URLs (for example one for
77 git:// protocol access, another for http:// access) from the gitweb
78 config file. [No default]
80 Points to the location where you put gitweb.css on your web server
81 (or to be more generic, the URI of gitweb stylesheet). Relative to the
82 base URI of gitweb. Note that you can setup multiple stylesheets from
83 the gitweb config file. [Default: gitweb.css]
85 Points to the location where you put git-logo.png on your web server
86 (or to be more generic URI of logo, 72x27 size, displayed in top right
87 corner of each gitweb page, and used as logo for Atom feed). Relative
88 to base URI of gitweb. [Default: git-logo.png]
90 Points to the location where you put git-favicon.png on your web server
91 (or to be more generic URI of favicon, assumed to be image/png type;
92 web browsers that support favicons (website icons) may display them
93 in the browser's URL bar and next to site name in bookmarks). Relative
94 to base URI of gitweb. [Default: git-favicon.png]
96 This Perl file will be loaded using 'do' and can be used to override any
97 of the options above as well as some other options -- see the "Runtime
98 gitweb configuration" section below, and top of 'gitweb.cgi' for their
99 full list and description. If the environment variable GITWEB_CONFIG
100 is set when gitweb.cgi is executed, then the file specified in the
101 environment variable will be loaded instead of the file specified
102 when gitweb.cgi was created. [Default: gitweb_config.perl]
103 * GITWEB_CONFIG_SYSTEM
104 This Perl file will be loaded using 'do' as a fallback if GITWEB_CONFIG
105 does not exist. If the environment variable GITWEB_CONFIG_SYSTEM is set
106 when gitweb.cgi is executed, then the file specified in the environment
107 variable will be loaded instead of the file specified when gitweb.cgi was
108 created. [Default: /etc/gitweb.conf]
111 Runtime gitweb configuration
112 ----------------------------
114 You can adjust gitweb behaviour using the file specified in `GITWEB_CONFIG`
115 (defaults to 'gitweb_config.perl' in the same directory as the CGI), and
116 as a fallback `GITWEB_CONFIG_SYSTEM` (defaults to /etc/gitweb.conf).
117 The most notable thing that is not configurable at compile time are the
118 optional features, stored in the '%features' variable.
120 Ultimate description on how to reconfigure the default features setting
121 in your `GITWEB_CONFIG` or per-project in `project.git/config` can be found
122 as comments inside 'gitweb.cgi'.
124 See also the "Gitweb config file" (with an example of config file), and
125 the "Gitweb repositories" sections in INSTALL file for gitweb.
128 The gitweb config file is a fragment of perl code. You can set variables
129 using "our $variable = value"; text from "#" character until the end
130 of a line is ignored. See perlsyn(1) man page for details.
132 Below is the list of variables which you might want to set in gitweb config.
133 See the top of 'gitweb.cgi' for the full list of variables and their
136 Gitweb config file variables
137 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139 You can set, among others, the following variables in gitweb config files
140 (with the exception of $projectroot and $projects_list this list does
141 not include variables usually directly set during build):
143 Core git executable to use. By default set to "$GIT_BINDIR/git", which
144 in turn is by default set to "$(bindir)/git". If you use git from binary
145 package, set this to "/usr/bin/git". This can just be "git" if your
146 webserver has a sensible PATH. If you have multiple git versions
147 installed it can be used to choose which one to use.
149 Gitweb version, set automatically when creating gitweb.cgi from
150 gitweb.perl. You might want to modify it if you are running modified
153 Absolute filesystem path which will be prepended to project path;
154 the path to repository is $projectroot/$project. Set to
155 $GITWEB_PROJECTROOT during installation. This variable have to be
156 set correctly for gitweb to find repositories.
158 Source of projects list, either directory to scan, or text file
159 with list of repositories (in the "<URI-encoded repository path> SP
160 <URI-encoded repository owner>" line format; actually there can be
161 any sequence of whitespace in place of space (SP)). Set to
162 $GITWEB_LIST during installation. If empty, $projectroot is used
163 to scan for repositories.
165 URL and absolute URL of gitweb script; you might need to set those
166 variables if you are using 'pathinfo' feature: see also below.
168 Target of the home link on top of all pages (the first part of view
169 "breadcrumbs"). By default set to absolute URI of a page; you might
170 need to set it up to [base] gitweb URI if you use 'pathinfo' feature
171 (alternative format of the URLs, with project name embedded directly
172 in the path part of URL).
174 List of URIs of stylesheets (relative to base URI of a page). You
175 might specify more than one stylesheet, for example use gitweb.css
176 as base, with site specific modifications in separate stylesheet
177 to make it easier to upgrade gitweb. You can add 'site' stylesheet
179 push @stylesheets, "gitweb-site.css";
180 in the gitweb config file.
181 * $logo_url, $logo_label
182 URI and label (title) of GIT logo link (or your site logo, if you choose
183 to use different logo image). By default they point to git homepage;
184 in the past they pointed to git documentation at www.kernel.org.
185 * $projects_list_description_width
186 The width (in characters) of the projects list "Description" column.
187 Longer descriptions will be cut (trying to cut at word boundary);
188 full description is available as 'title' attribute (usually shown on
189 mouseover). By default set to 25, which might be too small if you
190 use long project descriptions.
192 List of git base URLs used for URL to where fetch project from, shown
193 in project summary page. Full URL is "$git_base_url/$project".
194 You can setup multiple base URLs (for example one for git:// protocol
195 access, and one for http:// "dumb" protocol access). Note that per
196 repository configuration in 'cloneurl' file, or as values of gitweb.url
198 * $default_blob_plain_mimetype
199 Default mimetype for blob_plain (raw) view, if mimetype checking
200 doesn't result in some other type; by default 'text/plain'.
201 * $default_text_plain_charset
202 Default charset for text files. If not set, web server configuration
205 File to use for (filename extension based) guessing of MIME types before
206 trying /etc/mime.types. Path, if relative, is taken currently as
207 relative to the current git repository.
209 Gitweb assumes this charset if line contains non-UTF-8 characters.
210 Fallback decoding is used without error checking, so it can be even
211 'utf-8'. Value mist be valid encodig; see Encoding::Supported(3pm) man
212 page for a list. By default 'latin1', aka. 'iso-8859-1'.
214 Rename detection options for git-diff and git-diff-tree. By default
215 ('-M'); set it to ('-C') or ('-C', '-C') to also detect copies, or
216 set it to () if you don't want to have renames detection.
218 To activate caching, set this to an instance of a Cache::Cache
219 compatible cache. You'll typically use a Memcached instance here:
220 use Cache::Memcached;
221 $cache = Cache::Memcached->new( { servers => ['localhost:11211'],
222 compress_threshold => 1000 } );
224 A directory in which gitweb will store potentially large cache
225 items (like snapshots or blobs). Cache items in this directory are
226 not deleted, so you should clean it up yourself periodically.
227 Default: undef (no caching for large items).
229 Set to 1 to display cache statistics at the bottom of each page.
230 After setting up caching, you should set this to 1 temporarily and
231 make sure that after opening some blob page (a=blob) for the second
232 time, the statistics at the bottom of the page show cache hits (and
233 no misses) for both the main cache and the large cache. If there
234 are nonzero "failed sets" statistics, then for the "main cache"
235 they indicate that memcached is not working (check that it is
236 actually running), and for the "large cache" they indicate that
237 writing to the $large_cache_root directory didn't work (typically
238 permission problems). Once you have verified that caching works,
239 set $page_info back to zero.
242 Projects list file format
243 ~~~~~~~~~~~~~~~~~~~~~~~~~
245 Instead of having gitweb find repositories by scanning filesystem starting
246 from $projectroot (or $projects_list, if it points to directory), you can
247 provide list of projects by setting $projects_list to a text file with list
248 of projects (and some additional info). This file uses the following
251 One record (for project / repository) per line, whitespace separated fields;
252 does not support (at least for now) lines continuation (newline escaping).
253 Leading and trailing whitespace are ignored, any run of whitespace can be
254 used as field separator (rules for Perl's "split(' ', $line)"). Keyed by
255 the first field, which is project name, i.e. path to repository GIT_DIR
256 relative to $projectroot. Fields use modified URI encoding, defined in
257 RFC 3986, section 2.1 (Percent-Encoding), or rather "Query string encoding"
258 (see http://en.wikipedia.org/wiki/Query_string#URL_encoding), the difference
259 being that SP (' ') can be encoded as '+' (and therefore '+' has to be also
260 percent-encoded). Reserved characters are: '%' (used for encoding), '+'
261 (can be used to encode SPACE), all whitespace characters as defined in Perl,
262 including SP, TAB and LF, (used to separate fields in a record).
264 Currently list of fields is
265 * <repository path> - path to repository GIT_DIR, relative to $projectroot
266 * <repository owner> - displayed as repository owner, preferably full name,
269 You can additionally use $projects_list file to limit which repositories
270 are visible, and together with $strict_export to limit access to
271 repositories (see "Gitweb repositories" section in gitweb/INSTALL).
274 Per-repository gitweb configuration
275 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
277 You can also configure individual repositories shown in gitweb by creating
278 file in the GIT_DIR of git repository, or by setting some repo configuration
279 variable (in GIT_DIR/config).
281 You can use the following files in repository:
283 A .html file (HTML fragment) which is included on the gitweb project
284 summary page inside <div> block element. You can use it for longer
285 description of a project, to provide links (for example to project's
287 * description (or gitweb.description)
288 Short (shortened by default to 25 characters in the projects list page)
289 single line description of a project (of a repository). Plain text file;
290 HTML will be escaped. By default set to
291 Unnamed repository; edit this file to name it for gitweb.
292 from the template during repository creation. You can use the
293 gitweb.description repo configuration variable, but the file takes
295 * cloneurl (or multiple-valued gitweb.url)
296 File with repository URL (used for clone and fetch), one per line.
297 Displayed in the project summary page. You can use multiple-valued
298 gitweb.url repository configuration variable for that, but the file
301 You can use the gitweb.owner repository configuration variable to set
302 repository's owner. It is displayed in the project list and summary
303 page. If it's not set, filesystem directory's owner is used
304 (via GECOS field / real name field from getpwiud(3)).
305 * various gitweb.* config variables (in config)
306 Read description of %feature hash for detailed list, and some
310 Webserver configuration
311 -----------------------
313 If you want to have one URL for both gitweb and your http://
314 repositories, you can configure apache like this:
317 ServerName git.example.org
318 DocumentRoot /pub/git
319 SetEnv GITWEB_CONFIG /etc/gitweb.conf
321 # make the front page an internal rewrite to the gitweb script
322 RewriteRule ^/$ /cgi-bin/gitweb.cgi
323 # make access for "dumb clients" work
324 RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT]
327 The above configuration expects your public repositories to live under
328 /pub/git and will serve them as http://git.domain.org/dir-under-pub-git,
329 both as cloneable GIT URL and as browseable gitweb interface.
330 If you then start your git-daemon with --base-path=/pub/git --export-all
331 then you can even use the git:// URL with exactly the same path.
333 Setting the environment variable GITWEB_CONFIG will tell gitweb to use
334 the named file (i.e. in this example /etc/gitweb.conf) as a
335 configuration for gitweb. Perl variables defined in here will
336 override the defaults given at the head of the gitweb.perl (or
337 gitweb.cgi). Look at the comments in that file for information on
338 which variables and what they mean.
340 If you use the rewrite rules from the example you'll likely also need
341 something like the following in your gitweb.conf (or gitweb_config.perl) file:
343 @stylesheets = ("/some/absolute/path/gitweb.css");
348 Originally written by:
349 Kay Sievers <kay.sievers@vrfy.org>
351 Any comment/question/concern to:
352 Git mailing list <git@vger.kernel.org>