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 😉 ).
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).
can you post how you managed the .netrc to supply credentials
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.
[…] Git repository with Apache (via WebDAV) and gitweb « Aquì estamos! (tags: git webdav gitweb apache) […]
[…] Git repository with Apache (via WebDAV) and gitweb(อันนี้มีตัวอย่าง … […]
[…] We can use the following configuration, some parts have been copied from the kaeso blog: […]
[…] Git repository with Apache (via WebDAV) and gitweb « Aquì estamos! (tags: gitweb tutorial webdav https) […]
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….
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
The tip for Limitexcept really improved performance of operations like git pull.
Your gitweb configuration link appears to be dead
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