Git repository with Apache (via WebDAV) and gitweb

I’ve just finished setting up my semi-personal git repository. I was forced to use apache authentication on https (instead of the usual git-daemon or a more canonical ssh authentication) as my hostel/university firewall is particularly fascist. I choose gitweb as web interface, because it seems to be the most widespread and I’m quite comfortable with it (and is available in Debian Etch ;) ).

Logo git

As a starting point, I used the official Howto to understand how this is expected to work, and a quick readme for gitweb. I won’t go into details about gitweb configuration, as it’s extensively explained somewhere else.

First of all, the usual Vhost, Root and SSL lines:

<VirtualHost *:443>
ServerAdmin hostmaster@example.com
ServerName git.example.com
SSLEngine On
SSLCertificateKeyFile /etc/ssl/your_domain.key
SSLCertificateFile /etc/ssl/your_domain.crt
DocumentRoot /var/www/git

Then the gitweb relevant part:

Options Indexes FollowSymlinks ExecCGI
DirectoryIndex index
Alias /gitweb.css /var/www/gitweb.css
Alias /git-logo.png /var/www/git-logo.png
Alias /git-favicon.png /var/www/git-favicon.png
ScriptAlias /index /usr/lib/cgi-bin/gitweb.cgi

All those Aliases are just because I didn’t copy those file in proper directories, but instead I used directly the one provided by packages. index here is used only as placeholder for the gitweb index script.
Then the real repository part, managed with DAV:

<Location /my_repo.git>
Dav on
AuthType Basic
AuthName "My repo with git"
AuthUserFile /etc/apache2/git_repo.passwd
<Limitexcept GET HEAD PROPFIND OPTIONS REPORT>
Require valid-user
</Limitexcept>
</Location>

This way, everybody can git-clone my repository (yes, it mainly contains free-software stuff :) ), but pushing is only available to those authenticated (via the usual BasicAuth mechanism and ~/.netrc credentials).

Iscriviti

Ricevi al tuo indirizzo email tutti i nuovi post del sito.