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).

Git repository with Apache (via WebDAV) and gitweb

11 pensieri su “Git repository with Apache (via WebDAV) and gitweb

  1. just write your ~/.netrc as follow:

    machine git.example.com
    login your_user
    password your_password

    AFAIK you cannot have different authentications/password for various repositories on the same server. Anyway, see `man 5 netrc` for all the info.

  2. Only propblem is that when having this setup the hook scripts will not be executed as Apache does not know about GIT… This is a huge problem for my repo at the moment….

Lascia un commento

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...