I made a previous post about serving a git repository via Apache, and the method of delivery was WebDAV. Fast forward a couple of years and I find myself trying to use the same setup on our lab machine. In the end, it doesn’t work: in spite of everything, a git push
will always fail due to some error locking a refs file. I ended up giving up on WebDAV and going with git-http-backend.
The setup is essentially identical to the first example here. A vanilla apache 2.4 install will have the modules (mod_cgi, mod_alias, mod_env
) available, so it’s just a matter of uncommenting those in httpd.conf
. I only had to change the ScriptAlias
line to point git
to the git-http-backend
command in the local install of git
. We already had a basic auth file that we use with the mod_dav_svn
setup which we reused to protect access to the git repositories. Everything just worked and we didn’t need to rebuild apache.
I kind of regret spending so much time compiling Apache 2.4 thinking that the error had to do with running Apache 2.2, but then again it was a nice exercise in building a bunch of interlinked libraries on Centos. One thing I learned is that in the typical configure-make-make install cycle, ./configure --prefix=PREFIX
is really useful to do. I always felt terrible about sending everything to /usr/local
because (1) it gets pretty messy, and (2) you might not have permission to do it. But having picked up the CMake convention of always building projects with an out-of-source build, this makes a lot of sense to do a lot of the time, especially if you’re building stuff just to try out. I ended up not needing most of the stuff I built and now I don’t have to worry about cleaning up /usr/local
.