+From: Rutger Nijlunsing <firstname.lastname@example.org>
+Subject: Setting up a git repository which can be pushed into and pulled from over HTTP.
+Date: Thu, 10 Aug 2006 22:00:26 +0200
+Since Apache is one of those packages people like to compile
+themselves while others prefer the bureaucrat's dream Debian, it is
+impossible to give guidelines which will work for everyone. Just send
+some feedback to the mailing list at email@example.com to get this
+document tailored to your favorite distro.
+- Have an Apache web-server
+ $ apt-get install apache2
+ To get apache2 by default started,
+ edit /etc/default/apache2 and set NO_START=0
+- can edit the configuration of it.
+ This could be found under /etc/httpd, or refer to your Apache documentation.
+ On Debian: this means being able to edit files under /etc/apache2
+ 'apachectl --graceful' might do. If it doesn't, just stop and
+ restart apache. Be warning that active connections to your server
+ might be aborted by this.
+ $ /etc/init.d/apache2 restart
+ $ /etc/init.d/apache2 force-reload
+ (which seems to do the same)
+ This adds symlinks from the /etc/apache2/mods-enabled to
+- have permissions to chown a directory
+- have git installed at the server _and_ client
+In effect, this probably means you're going to be root.
+Step 1: setup a bare GIT repository
+At the time of writing, git-http-push cannot remotely create a GIT
+repository. So we have to do that at the server side with git. Another
+option would be to generate an empty repository at the client and copy
+it to the server with WebDAV. But then you're probably the first to
+Create the directory under the DocumentRoot of the directories served
+by Apache. As an example we take /usr/local/apache2, but try "grep
+DocumentRoot /where/ever/httpd.conf" to find your root:
+ $ cd /usr/local/apache/htdocs
+ $ mkdir my-new-repo.git
+ $ mkdir my-new-repo.git
+Initialize a bare repository
+Change the ownership to your web-server's credentials. Use "grep ^User
+httpd.conf" and "grep ^Group httpd.conf" to find out:
+ $ chown -R www-data.www-data .
+If you do not know which user Apache runs as, you can alternatively do
+a "chmod -R a+w .", inspect the files which are created later on, and
+set the permissions appropriately.
+Restart apache2, and check whether http://server/my-new-repo.git gives
+a directory listing. If not, check whether apache started up
+Step 2: enable DAV on this repository
+First make sure the dav_module is loaded. For this, insert in httpd.conf:
+ LoadModule dav_module libexec/httpd/libdav.so
+Also make sure that this line exists which is the file used for
+ DAVLockDB "/usr/local/apache2/temp/DAV.lock"
+ On Debian these steps can be performed with:
+ Enable the dav and dav_fs modules of apache:
+ (just to be sure. dav_fs might be unneeded, I don't know)
+ The DAV lock is located in /etc/apache2/mods-available/dav_fs.conf:
+ DAVLockDB /var/lock/apache2/DAVLock
+Of course, it can point somewhere else, but the string is actually just a
+prefix in some Apache configurations, and therefore the _directory_ has to
+be writable by the user Apache runs as.
+Then, add something like this to your httpd.conf
+ <Location /my-new-repo.git>
+ AuthUserFile /usr/local/apache2/conf/passwd.git
+ Create (or add to) /etc/apache2/conf.d/git.conf :
+ <Location /my-new-repo.git>
+ AuthUserFile /etc/apache2/passwd.git
+ Debian automatically reads all files under /etc/apach2/conf.d.
+The password file can be somewhere else, but it has to be readable by
+Apache and preferably not readable by the world.
+ $ htpasswd -c /usr/local/apache2/conf/passwd.git <user>
+ $ htpasswd -c /etc/apache2/passwd.git <user>
+You will be asked a password, and the file is created. Subsequent calls
+to htpasswd should omit the '-c' option, since you want to append to the
+You need to restart Apache.
+Now go to http://<username>@<servername>/my-new-repo.git in your
+browser to check whether it asks for a password and accepts the right
+ To test the WebDAV part, do:
+ $ apt-get install litmus
+ $ litmus http://<servername>/my-new-repo.git <username> <password>
+ Most tests should pass.
+A command line tool to test WebDAV is cadaver.
+If you're into Windows, from XP onwards Internet Explorer supports
+WebDAV. For this, do Internet Explorer -> Open Location ->
+http://<servername>/my-new-repo.git [x] Open as webfolder -> login .
+Step 3: setup the client
+Make sure that you have HTTP support, i.e. your git was built with curl.
+The easiest way to check is to look for the executable 'git-http-push'.
+Then, add the following to your $HOME/.netrc (you can do without, but will be
+asked to input your password a _lot_ of times):
+If you want to access the web-server by its IP, you have to type that in,
+instead of the server name.
+To check whether all is OK, do:
+ curl --netrc --location -v http://<username>@<servername>/my-new-repo.git/
+...this should give a directory listing in HTML of /var/www/my-new-repo.git .
+Now, add the remote in your existing repository which contains the project
+ $ git-repo-config remote.upload.url \
+It is important to put the last '/'; Without it, the server will send
+a redirect which git-http-push does not (yet) understand, and git-http-push
+will repeat the request infinitely.
+Step 4: make the initial push
+From your client repository, do
+ $ git push upload master
+This pushes branch 'master' (which is assumed to be the branch you
+want to export) to repository called 'upload', which we previously
+defined with git-repo-config.
+ Error: no DAV locking support on remote repo http://...
+then it means the web-server did not accept your authentication. Make sure
+that the user name and password matches in httpd.conf, .netrc and the URL
+If git-http-push shows you an error (22/502) when trying to MOVE a blob,
+it means that your web-server somehow does not recognize its name in the
+request; This can happen when you start Apache, but then disable the
+network interface. A simple restart of Apache helps.
+Errors like (22/502) are of format (curl error code/http error
+code). So (22/404) means something like 'not found' at the server.
+Reading /usr/local/apache2/logs/error_log is often helpful.
+ On Debian: Read /var/log/apache2/error.log instead.
+Debian References: http://www.debian-administration.org/articles/285
+ Johannes Schindelin <Johannes.Schindelin@gmx.de>
+ Rutger Nijlunsing <firstname.lastname@example.org>