Thursday, November 12, 2009

Git solves your problems

So last night, I wanted to install a Subversion server on Emma's darling quad-core behemoth hosting akerr.net among *other things*. Inspecting the installation, it seems mod_dav was not compiled into Apache2.x, and no one after Apache 1.3 seems to suggest loading it as a dynamic shared library. I successfully compiled several test builds of Apache2.2 in user space, but matching Emma's configuration in a maintainable way would have been a nightmare inside of doubtfulness wrapped in the promise of sleepless nights down the road if things go wrong.

Then I went looking for alternatives. It seems the only administrative prerequisites for hosting a remote Git repository are that the host runs sshd and you to have an account on said machine. After installing the lovely msysgit git client for Windows on my home desktop, I performed the following.

On the remote side:

$ ssh akerr@akerr.net:
$ mkdir akerr.git && cd akerr.git
$ git --bare init
Initialized empty Git repository in /home/akerr/akerr.git/
$


On the local side:

$ cd C:/research/akerr
$ git init
$ git remote add origin "ssh://akerr@akerr.net:<ssh port>/~/akerr.git"
$ git add infrastructure/
...
$ git commit -a -m "initial revision of libkerr"
$ git push origin master
...
$


This is all that is needed. To pull from the remote host, simply perform the following:


$ git pull origin master
...
$


The elegant components of this solution are:
- doesn't require superuser access or configuration changes on the host
- security is a function of SSH
- git is fast and functional in an isolated environment

Thank you, Emma, for the free hosting. This helps you too. : )

4 comments:

Unknown said...

:-)

sstc said...

hey, do you have an errant ":" in your setting up of the remote origin?

I used
git clone "ssh://username@host.com/~username/MAINGIT" localfoldername

on my boxes one the repo was made.

Spatchcock said...

Actually, I had some additional text behind the colon that I didn't escape.

We don't use the traditional ssh port, and I had attempted to include some text that indicated as much. Blogger didn't appreciate it.

Here is an example of what I meant:

"ssh://akerr@akerr.net:2222/~/akerr.git/"

sstc said...

thanks, I figured you used a non-standard port. I ran into some fun ssh issues due to my ssh default security level. I have two boxes behind one ip, using separate ports for sshing. My security model warns me if I connect to the same ip but have a different signature. git doesn't handle saying yes (appropriately), so I had to let everything know about the configuration.

ha, i assume you did something like "(less than sign) optional thing (greater than sign)" which it took as html?