gitweb / INSTALLon commit Merge branch 'sg/t3600-nul-sha1-fix' (504c194)
   1GIT web Interface (gitweb) Installation
   2=======================================
   3
   4First you have to generate gitweb.cgi from gitweb.perl using
   5"make gitweb", then "make install-gitweb" appropriate files
   6(gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png)
   7to their destination. For example if git was (or is) installed with
   8/usr prefix and gitwebdir is /var/www/cgi-bin, you can do
   9
  10        $ make prefix=/usr gitweb                            ;# as yourself
  11        # make gitwebdir=/var/www/cgi-bin install-gitweb     ;# as root
  12
  13Alternatively you can use autoconf generated ./configure script to
  14set up path to git binaries (via config.mak.autogen), so you can write
  15instead
  16
  17        $ make configure                     ;# as yourself
  18        $ ./configure --prefix=/usr          ;# as yourself
  19        $ make gitweb                        ;# as yourself
  20        # make gitwebdir=/var/www/cgi-bin \
  21               install-gitweb                ;# as root
  22
  23The above example assumes that your web server is configured to run
  24[executable] files in /var/www/cgi-bin/ as server scripts (as CGI
  25scripts).
  26
  27
  28Requirements
  29------------
  30
  31 - Core git tools
  32 - Perl
  33 - Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.
  34 - web server
  35
  36The 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
  43Build time configuration
  44------------------------
  45
  46See also "How to configure gitweb for your local system" section below.
  47
  48- There are many configuration variables which affect building of
  49  gitweb.cgi; see "default configuration for gitweb" section in main
  50  (top dir) Makefile, and instructions for building gitweb target.
  51
  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
  54  when building gitweb.cgi, or $prefix from which $bindir is derived. If
  55  you build and install gitweb together with the rest of the git suite,
  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
  61  available to gitweb. By default gitweb searches for repositories under
  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
  66  available to gitweb. The list of projects is generated by default by
  67  scanning the projectroot directory for git repositories. This can be
  68  changed (configured) as described in "Gitweb repositories" section
  69  below.
  70
  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
  73  repository object database, usually projectname.git for bare
  74  repositories. If you want to provide gitweb access to non-bare (live)
  75  repositories, you can make projectname.git a symbolic link under
  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,
  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.
  83
  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.
  89
  90
  91How to configure gitweb for your local system
  92---------------------------------------------
  93
  94You 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]
 133 * GITWEB_SITE_HTML_HEAD_STRING
 134   html snippet to include in the <head> section of each page. [No default]
 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)]
 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]
 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]
 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
 211Build example
 212~~~~~~~~~~~~~
 213
 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
 218
 219        make GITWEB_PROJECTROOT="/home/local/scm" \
 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" \
 224             bindir=/usr/local/bin \
 225             gitweb
 226
 227        make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb
 228
 229
 230Gitweb config file
 231------------------
 232
 233See also "Runtime gitweb configuration" section in README file
 234for gitweb (in gitweb/README), and gitweb.conf(5) manpage.
 235
 236- You can configure gitweb further using the per-instance gitweb configuration file;
 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
 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
 244  through the GITWEB_CONFIG_SYSTEM environment variable.
 245
 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
 251  system-wide configuration file override those from common system-wide
 252  configuration file.
 253
 254- The gitweb config file is a fragment of perl code. You can set variables
 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
 260Config file example
 261~~~~~~~~~~~~~~~~~~~
 262
 263To enable blame, pickaxe search, and snapshot support, while allowing
 264individual projects to turn them off, put the following in your
 265GITWEB_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
 273        $feature{'snapshot'}{'default'} = ['zip', 'tgz'];
 274        $feature{'snapshot'}{'override'} = 1;
 275
 276If you allow overriding for the snapshot feature, you can specify which
 277snapshot formats are globally disabled. You can also add any command line
 278options you want (such as setting the compression level). For instance,
 279you can disable Zip compressed snapshots and set GZip to run at level 6 by
 280adding the following lines to your $GITWEB_CONFIG:
 281
 282        $known_snapshot_formats{'zip'}{'disabled'} = 1;
 283        $known_snapshot_formats{'tgz'}{'compressor'} = ['gzip','-6'];
 284
 285
 286Gitweb repositories
 287-------------------
 288
 289By default gitweb shows all git repositories under single common repository
 290root on a local filesystem; see description of GITWEB_PROJECTROOT build-time
 291configuration variable above (and also of GITWEB_LIST).
 292
 293More advanced usage, like limiting access or visibility of repositories and
 294managing multiple roots are described on gitweb manpage.
 295
 296
 297Example web server configuration
 298~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 299
 300See also "Webserver configuration" and "Advanced web server setup" sections
 301in gitweb(1) manpage.
 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>