1GIT web Interface (gitweb) Installation
2=======================================
34
First you have to generate gitweb.cgi from gitweb.perl using
5"make gitweb/gitweb.cgi", then copy appropriate files (gitweb.cgi,
6gitweb.css, git-logo.png and git-favicon.png) to their destination.
7For example if git was (or is) installed with /usr prefix, you can do
89
$ make prefix=/usr gitweb/gitweb.cgi ;# as yourself
10# cp gitweb/git* /var/www/cgi-bin/ ;# as root
1112
Alternatively you can use autoconf generated ./configure script to
13set up path to git binaries (via config.mak.autogen), so you can write
14instead
1516
$ make configure ;# as yourself
17$ ./configure --prefix=/usr ;# as yourself
18$ make gitweb/gitweb.cgi ;# as yourself
19# cp gitweb/git* /var/www/cgi-bin/ ;# as root
2021
The above example assumes that your web server is configured to run
22[executable] files in /var/www/cgi-bin/ as server scripts (as CGI
23scripts).
2425
26
Build time configuration
27------------------------
2829
See also "How to configure gitweb for your local system" in README
30file for gitweb (in gitweb/README).
3132
- There are many configuration variables which affects building of
33gitweb.cgi; see "default configuration for gitweb" section in main
34(top dir) Makefile, and instructions for building gitweb/gitweb.cgi
35target.
3637
One of most important is where to find git wrapper binary. Gitweb
38tries to find git wrapper at $(bindir)/git, so you have to set $bindir
39when building gitweb.cgi, or $prefix from which $bindir is derived. If
40you build and install gitweb together with the rest of git suite,
41there should be no problems. Otherwise, if git was for example
42installed from a binary package, you have to set $prefix (or $bindir)
43accordingly.
4445
- Another important issue is where are git repositories you want to make
46available to gitweb. By default gitweb search for repositories under
47/pub/git; if you want to have projects somewhere else, like /home/git,
48use GITWEB_PROJECTROOT build configuration variable.
4950
By default all git repositories under projectroot are visible and
51available to gitweb. List of projects is generated by default by
52scanning the projectroot directory for git repositories. This can be
53changed (configured) as described in "Gitweb repositories" section
54below.
5556
Note that gitweb deals directly with object database, and does not
57need working directory; the name of the project is the name of its
58repository object database, usually projectname.git for bare
59repositories. If you want to provide gitweb access to non-bare (live)
60repository, you can make projectname.git symbolic link under
61projectroot linking to projectname/.git (but it is just
62a suggestion).
6364
- You can control where gitweb tries to find its main CSS style file,
65its favicon and logo with GITWEB_CSS, GITWEB_FAVICON and GITWEB_LOGO
66build configuration variables. By default gitweb tries to find them
67in the same directory as gitweb.cgi script.
6869
Build example
70~~~~~~~~~~~~~
7172
- To install gitweb to /var/www/cgi-bin/gitweb/ when git wrapper
73is installed at /usr/local/bin/git and the repositories (projects)
74we want to display are under /home/local/scm, you can do
7576
make GITWEB_PROJECTROOT="/home/local/scm" \
77GITWEB_CSS="/gitweb/gitweb.css" \
78GITWEB_LOGO="/gitweb/git-logo.png" \
79GITWEB_FAVICON="/gitweb/git-favicon.png" \
80bindir=/usr/local/bin \
81gitweb/gitweb.cgi
8283
cp -fv ~/git/gitweb/gitweb.{cgi,css} \
84~/git/gitweb/git-{favicon,logo}.png \
85/var/www/cgi-bin/gitweb/
8687
88
Gitweb config file
89------------------
9091
See also "Runtime gitweb configuration" section in README file
92for gitweb (in gitweb/README).
9394
- You can configure gitweb further using gitweb configuration file;
95by default it is file named gitweb_config.perl in the same place as
96gitweb.cgi script. You can control default place for config file
97using GITWEB_CONFIG build configuration variable, and you can set it
98using GITWEB_CONFIG environmental variable.
99100
- Gitweb config file is [fragment] of perl code. You can set variables
101using "our $variable = value"; text from "#" character until the end
102of a line is ignored. See perlsyn(1) for details.
103104
See the top of gitweb.perl file for examples of customizable options.
105106
107
Gitweb repositories:
108--------------------
109110
- By default all git repositories under projectroot are visible and
111available to gitweb. List of projects is generated by default by
112scanning the projectroot directory for git repositories (for object
113databases to be more exact).
114115
You can provide pre-generated list of [visible] repositories,
116together with information about their owners (the project ownership
117is taken from owner of repository directory otherwise), by setting
118GITWEB_LIST build configuration variable (or $projects_list variable
119in gitweb config file) to point to a plain file.
120121
Each line of projects list file should consist of url-encoded path
122to project repository database (relative to projectroot) separated
123by space from url-encoded project owner; spaces in both project path
124and project owner have to be encoded as either '%20' or '+'.
125126
You can generate projects list index file using project_index action
127(the 'TXT' link on projects list page) directly from gitweb.
128129
- By default even if project is not visible on projects list page, you
130can view it nevertheless by hand-crafting gitweb URL. You can set
131GITWEB_STRICT_EXPORT build configuration variable (or $strict_export
132variable in gitweb config file) to only allow viewing of
133repositories also shown on the overview page.
134135
- Alternatively, you can configure gitweb to only list and allow
136viewing of the explicitly exported repositories, via
137GITWEB_EXPORT_OK build configuration variable (or $export_ok
138variable in gitweb config file). If it evaluates to true, gitweb
139show repository only if this file exists in its object database
140(if directory has the magic file $export_ok).
141142
143
Requirements
144------------
145146
- Core git tools
147- Perl
148- Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.
149- web server
150151
152
Example web server configuration
153~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154155
See also "Webserver configuration" section in README file for gitweb
156(in gitweb/README).
157158
159
- Apache2, gitweb installed as CGI script,
160under /var/www/cgi-bin/
161162
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
163164
<Directory "/var/www/cgi-bin">
165Options Indexes FollowSymlinks ExecCGI
166AllowOverride None
167Order allow,deny
168Allow from all
169</Directory>
170171
- Apache2, gitweb installed as mod_perl legacy script,
172under /var/www/perl/
173174
Alias /perl "/var/www/perl"
175176
<Directory "/var/www/perl">
177SetHandler perl-script
178PerlResponseHandler ModPerl::Registry
179PerlOptions +ParseHeaders
180Options Indexes FollowSymlinks +ExecCGI
181AllowOverride None
182Order allow,deny
183Allow from all
184</Directory>