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

6 Commenti

  1. ramez hanna ha detto,

    1 Ottobre 2008 a 2:28 pm

    can you post how you managed the .netrc to supply credentials

  2. kaeso ha detto,

    9 Ottobre 2008 a 11:56 am

    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.

  3. 11 Ottobre 2008 a 8:04 am

    [...] Git repository with Apache (via WebDAV) and gitweb « Aquì estamos! (tags: git webdav gitweb apache) [...]

  4. 20 Novembre 2008 a 6:18 am

    [...] Git repository with Apache (via WebDAV) and gitweb(อันนี้มีตัวอย่าง … [...]

  5. 16 Febbraio 2009 a 9:05 pm

    [...] We can use the following configuration, some parts have been copied from the kaeso blog: [...]

  6. 4 Marzo 2009 a 8:05 am

    [...] Git repository with Apache (via WebDAV) and gitweb « Aquì estamos! (tags: gitweb tutorial webdav https) [...]


Pubblica un Commento