Created
July 13, 2012 03:56
-
-
Save iphoting/3102634 to your computer and use it in GitHub Desktop.
Gitolite v3 gitweb.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gitweb configuration | |
Alias /gitweb /usr/share/gitweb | |
RewriteEngine On | |
RewriteRule ^gitweb$ gitweb/ [R] | |
<Directory /usr/share/gitweb> | |
Order allow,deny | |
Allow from all | |
Options ExecCgi FollowSymLinks SymLinksIfOwnerMatch | |
DirectoryIndex gitweb.cgi | |
SetEnv GITWEB_CONFIG /etc/gitweb.conf | |
SetEnv HOME /home/gitolite | |
RewriteEngine On | |
RewriteBase /gitweb/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^.* gitweb.cgi/$0 [L,PT] | |
</Directory> | |
<Directory /home/gitolite/repositories> | |
Order allow,deny | |
Allow from all | |
</Directory> | |
<Location /gitweb> | |
AuthType Basic | |
AuthName "Authenticated Gitweb Access" | |
Require valid-user | |
AuthUserFile /home/gitolite/htpasswd | |
</Location> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HOME of the gitolite user | |
my $gl_home = $ENV{HOME} = "/home/gitolite"; | |
my $gl_hosting_user = "git"; | |
my $gl_host = $cgi->server_name || "localhost"; | |
# Your server hostname and port (if not 80 for http or 443 for https). | |
# Replace http for https if necessary. | |
$my_uri = "https://$gl_host/gitweb"; | |
# the following variables are needed by gitolite; please edit before using | |
# this should normally not be anything else | |
$ENV{GL_RC} = "$gl_home/.gitolite.rc"; | |
# this can have different values depending on how you installed. | |
# if you used RPM/DEB or "root" methods it **might** be this: | |
#$ENV{GL_BINDIR} = "/usr/local/bin"; | |
# if you used the "non-root" method it **might** be this: | |
$ENV{GL_BINDIR} = "$gl_home/bin"; | |
# If in doubt take a look at ~/.ssh/authorized_keys; at least one of the lines | |
# might contain something like: | |
# command="/home/git/.gitolite/src/gl-auth-command | |
# and you should use whatever directory the gl-auth-command is in (in this | |
# example /home/git/.gitolite.src) | |
# finally the user name | |
$ENV{GL_USER} = $cgi->remote_user || "daemon"; | |
# now get gitolite stuff in... | |
BEGIN { $ENV{HOME} = "/home/gitolite"; } | |
use lib "/home/gitolite/gitolite/src/lib"; | |
use Gitolite::Easy; | |
# set project root etc. absolute paths | |
$REPO_BASE ||= $ENV{GL_REPO_BASE}; | |
$ENV{GL_REPO_BASE_ABS} = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$gl_home/$REPO_BASE" ); | |
$projects_list = $projectroot = $ENV{GL_REPO_BASE_ABS}; | |
$export_auth_hook = sub { | |
my $repo = shift; | |
# gitweb passes us the full repo path; so we strip the beginning | |
# and the end, to get the repo name as it is specified in gitolite conf | |
return unless $repo =~ s/^\Q$projectroot\E\/?(.+)\.git$/$1/; | |
# check for (at least) "R" permission | |
return (can_read($repo)); | |
}; | |
# list of git base URLs used for URL to where fetch project from, | |
# i.e. full URL is "$git_base_url/$project" | |
our @git_base_url_list = ("git://$gl_host", "ssh://$gl_hosting_user\@$gl_host"); | |
# Make gitweb use an alternative format of the URLs which can be | |
# more readable and natural-looking: project name is embedded | |
# directly in the path and the query string contains other | |
# auxiliary information. All gitweb installations recognize | |
# URL in either format; this configures in which formats gitweb | |
# generates links. | |
$feature{'pathinfo'}{'default'} = [1]; | |
# Enable the 'blame' blob view, showing the last commit that modified | |
# each line in the file. This can be very CPU-intensive. | |
$feature{'blame'}{'default'} = [1]; | |
# Enable the 'snapshot' link, providing a compressed tarball of any | |
# tree. This can potentially generate high traffic if you have large | |
# project. | |
# To disable system wide have in /etc/gitweb.conf | |
$feature{'snapshot'}{'default'} = ['tbz2', 'tgz', 'zip']; | |
# Avatar support. When this feature is enabled, views such as | |
# shortlog or commit will display an avatar associated with | |
# the email of the committer(s) and/or author(s). | |
# Currently available providers are gravatar and picon. | |
# Gravatar depends on Digest::MD5. | |
$feature{'avatar'}{'default'} = ['Gravatar']; | |
# Enable displaying how much time and how many git commands | |
# it took to generate and display page. | |
$feature{'timed'}{'default'} = [1]; | |
# Enable turning some links into links to actions which require | |
# JavaScript to run (like 'blame_incremental'). | |
$feature{'javascript-actions'}{'default'} = [1]; | |
# Used to set the maximum load that we will still respond to gitweb queries. | |
# If server load exceed this value then return "503 server busy" error. | |
our $maxload = 2; | |
# Change below only if you've changed the base path, default: /gitweb | |
# directory to use for temp files | |
$git_temp = "/tmp"; | |
# target of the home link on top of all pages | |
#$home_link = $my_uri || "/"; | |
# html text to include at home page | |
$home_text = "indextext.html"; | |
# stylesheet to use | |
$stylesheet = "/gitweb/static/gitweb.css"; | |
# logo to use | |
$logo = "/gitweb/static/git-logo.png"; | |
# the 'favicon' | |
$favicon = "/gitweb/static/git-favicon.png"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment