Tested on Debian10
With subversion we were used to have a server that provides checkout/checkin operations as well as repository browsing. This blog shows how this can be achieved with git/gitweb as well.
The following packages have to be installed:
apache2, git, gitweb
We need to have a switch point that sends fetch/pull requests to the repository backend but browsing requests to the gitweb frontend. Therefore the apache configuration file consist of the two parts.
This blog assumes no access control for reading the repository but controls the pull requests. cgi has to be enabled.
This leads to the following apache2 configuration:
SetEnv GIT_PROJECT_ROOT /path/to/repos SetEnv GIT_HTTP_EXPORT_ALL # Enable git clone over HTTP ScriptAliasMatch \ "(?x)^/git/(.*/(HEAD | \ info/refs | \ objects/(info/[^/]+ | \ [0-9a-f]{2}/[0-9a-f]{38} | \ pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ git-(upload|receive)-pack))$" \ /usr/lib/git-core/git-http-backend/$1 # define access controlAuthType Basic AuthName "Git Access" AuthUserFile /var/svn/dav_svn.passwd Require all granted Require valid-user Options +ExecCGI Require all granted
Apache2 configuration:
# ScriptAlias for gitweb ScriptAlias /git /usr/share/gitweb/index.cgi Alias /static /usr/share/gitweb/static
In addition the gitweb configfile (/etc/gitweb.conf ) has to be adjusted, al least the $projectroot .
https://cweiske.de/tagebuch/apache24-git-http-backend.htmOptions +ExecCGI Require all granted
Letzte Aktualisierung: 1.7.2025
Powered by w3.css