Moving from svn to git

I’ve spent most of the evening trying to figure out how to use git. For a long time I’ve wanted to have the repositories for some of my personal projects available on the web. For a time I was allowing external access to my apache internal apache server, but I’m wary about that because I’m not confident about my ability to secure a box.

I was planning on setting subversion up on my web host, but I didn’t want to depend completely on that and mirroring subversion is non-trivial. So today I decided to have a go at git, which is much more suited to this sort of thing.

Thankfully there is svn import capability built in to git, so converting my guinea-pig project over was a doddle. Much more tricky was setting up all the syncing between the repos. I think I have the magic incantations down now though.

git remote add NAME URL
git config branch.master.remote NAME
git config branch.master.merge refs/heads/master

I understand the first line, the other two seem to be necessary, but I don’t know exactly what they do yet.

Also, it is better to run git pull than git push when dealing with a destination that has checked out files as push doesn’t update them whilst pull does.

One thing that is a little weird is I can’t push changes from the live site to the public repo, which is on the same server. But I can pull the changes down to my local machine then push back up to the public. Tried a couple of different ways but all failed for one reason of another.

Treating the other repo as local throws up permissions issues,

error: unable to create temporary sha1 filename
File exists

, due to the way webdav is setup on dreamhost. Treating it as remote (http) doesn’t work because the binary is compiled without curl support. Still, the round-trip method works well enough.

I also installed gitweb and pointed it at the publicly accessable repo, this was very easy contrary to all the web pages I read about it. Just name the config file gitweb_config.perl and tell it where to look for the git repos and away it went :-). is now available for anyone to view.