GitWeb (Ubuntu)
Installation
git clone git://git.kernel.org/pub/scm/git/git.git cd git make GITWEB_PROJECTROOT="/home/git" prefix=/usr gitweb sudo cp -Rf gitweb /var/www/ sudo chown -R www-data:www-data /var/www/gitweb
Bzw. über
sudo apt-get install gitweb
Konfiguration
Apache
sudo -u www-data htdigest -c /home/git/.htpasswd "Shared Git Repo" martin
sudo a2enmod auth_digest.load sudo systemctl restart apache2.service
cd /etc/apache2/sites-available/
http
sudo vi gitweb.conf
<virtualhost *:80>
ServerName git.<domain>
DocumentRoot /var/www/gitweb
<Directory /var/www/gitweb>
Options +FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi
</Directory>
ScriptAliasMatch \
"(?x)^/(.*/(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
SetEnv GIT_PROJECT_ROOT /home/git
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
<Location />
AuthType Digest
AuthName "Shared Git Repo"
AuthUserFile /home/git/.htpasswd
Require valid-user
</Location>
ErrorLog ${APACHE_LOG_DIR}/gitweb.<domain>-error.log
CustomLog ${APACHE_LOG_DIR}/gitweb.<domain>-access.log combined
</virtualhost>
sudo a2ensite gitweb.conf sudo service apache2 reload
https
SSL-Zertifikat erstellen - dazu siehe SSL_Zertifikat
sudo vi gitweb.conf
<VirtualHost *:80>
ServerName git.<domain>
ServerAlias git.<domain>
Redirect / https://git.<domain>
</VirtualHost>
sudo vi gitweb-ssl.conf
<virtualhost *:443>
ServerName git.<domain>
DocumentRoot /var/www/gitweb
SSLEngine On
SSLCertificateFile /etc/ssl/certs/git.crt
SSLCertificateKeyFile /etc/ssl/private/apache.key
<Directory /var/www/gitweb>
Options +FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi
</Directory>
ScriptAliasMatch \
"(?x)^/(.*/(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
SetEnv GIT_PROJECT_ROOT /home/git
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
<Location />
AuthType Digest
AuthName "Shared Git Repo"
AuthUserFile /home/git/.htpasswd
Require valid-user
</Location>
ErrorLog ${APACHE_LOG_DIR}/gitweb.<domain>-error.log
CustomLog ${APACHE_LOG_DIR}/gitweb.<domain>-access.log combined
</VirtualHost>
sudo a2ensite gitweb-ssl.conf sudo service apache2 reload
Beschreibung ändern
Die Beschreibung
Unnamed repository; edit this file 'description' to name the repository.
ändert man durch editieren der Datei
<root directory>/<repo>.git/description
Bei einem Klon des Repositories wird diese Beschreibung jedoch nicht übernommen.
Links
https://git-scm.com/book/de/v1/Git-auf-dem-Server-GitWeb
Zurück zu Git Server