My git server setup
So after having problems with gitlab.com (not being able to push to your own repository for example). I decided to have a very simple git setup, inspired by git.linkmauve.fr. I putted all my git repos into /git
.
started with just nginx and ssh
This one is dead-simple when you know the trick, simply put git update-server-info
into hooks/post-update
or hooks/post-receive
of your git repo (they have to be bare repo, that’s done with --bare)
Added git-daemon
That one was even more simple, just had to point to where the git repositories are stored
Wanted a better interface
While searching for alternatives to GNU I saw stagit, a static git generator (I don’t like CGI, specially when it could have access to my git repos), to use it I added theses lines to the post-update-hook
repo=$(pwd)
cd "$(pwd | sed s/.git$//)" && stagit -c "$repo.cache" "$repo"
cd /git && stagit-index *.git > /git/index.html
Garbage Collector
It’s not like my repos were getting big, git is supposed to do that itself but it seems like it doesn’t, so I’m doing git gc
each time, which isn’t very optimised.
Final Hook code (deploy, stagit, …)
This can be seen in my /git/utils repo, in the git-hooks
folder.
Also the blog is a symlink to /git/blog.work
which are the raw files done by that hook.