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

About these ads

14 commenti

  1. ramez hanna ha detto,

    01/10/2008 a 2:28 pm

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

  2. kaeso ha detto,

    09/10/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/10/2008 a 8:04 am

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

  4. 20/11/2008 a 6:18 am

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

  5. 16/02/2009 a 9:05 pm

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

  6. 04/03/2009 a 8:05 am

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

  7. peterschen ha detto,

    28/07/2010 a 5:24 pm

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

  8. Benoit Caccinolo ha detto,

    25/08/2010 a 4:06 pm

    Thanks for the doc, I did a sum up of my gitweb installation here http://ruready.tumblr.com/post/1008951976/gitweb-configuration-easy-way

    Benoit

  9. Erik Brakkee ha detto,

    27/03/2011 a 10:29 pm

    The tip for Limitexcept really improved performance of operations like git pull.

  10. Robin Degen ha detto,

    19/09/2011 a 8:26 am

    Your gitweb configuration link appears to be dead

  11. 31/05/2012 a 9:33 am

    I appreciate, cause I found exactly what I used to be having a look for.
    You’ve ended my 4 day lengthy hunt! God Bless you man. Have a great day. Bye

  12. chiaraimmagine.com ha detto,

    11/06/2013 a 5:27 am

    Pretty nice post. I just stumbled upon your blog and wanted
    to say that I’ve truly enjoyed surfing around your blog posts. In any case I’ll
    be subscribing to your feed and I hope you write again soon!

  13. wakonda ha detto,

    12/06/2013 a 11:47 am

    Thanks , I’ve recently been searching for information approximately this subject for ages and yours is the best I’ve discovered so far.
    However, what concerning the conclusion? Are you certain about the supply?

  14. 16/06/2013 a 2:46 am

    Hmm is anyone else encountering problems with the pictures
    on this blog loading? I’m trying to figure out if its a problem on my end or if it’s the blog.
    Any feed-back would be greatly appreciated.


Lascia un Commento

Fill in your details below or click an icon to log in:

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 )

Connessione a %s...

Iscriviti

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

%d bloggers like this: