using git on site5 (the details)

More to remind myself than anything else, this post provides the details for getting started using private git repositories on site5 (and pretty much any other shared hosting service that has ssh available and is willing to install git).

To start, you’ll need to politely ask the technical support people at site5 to install the latest stable redhat git rpm. They did this for me but mentioned that this is with no technical support (ie. if you mess up your repository somehow, you’re on your own) and that you must not leave any server side process running (such as git serve). You’ll also need ssh access to your site5 account – you enable this on backstage.site5.com.

I’m doing this on a brand new ubuntu hardy heron installation as I write this but everything I mention should work equally well on other linux distributions, mac os x and cygwin under windows.

Set up ssh dsa key pair

user@host:~$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_dsa): (hit enter)
Enter passphrase (empty for no passphrase): (enter a passphrase and hit enter)
Enter same passphrase again: (enter the same passphrase and hit enter)
Your identification has been saved in /home/user/.ssh/id_dsa.
Your public key has been saved in /home/user/.ssh/id_dsa.pub.
The key fingerprint is:
15:94:f2:f2:36:a7:37:1b:9c:23:80:30:96:30:ee:00 user@host
user@host:~$ scp ~/.ssh/id_dsa.pub remoteuser@remotehost:
remoteuser@remotehost's password: (enter password and hit enter)
id_dsa.pub 100% 605 0.6KB/s 00:00
user@host:~$ ssh remoteuser@remotehost:
remoteuser@remotehost's password: (enter password and hit enter)
Last login: Sat Aug 9 23:34:20 2008 from 122.122.122.122
[remoteuser@remotehost ~]$ cat id_dsa.pub >> .ssh/authorized_keys

You should now be able to ssh to your site5 account without being prompted for a password (you may be prompted for the passphrase for your key if ssh-agent is not setup – i’ll come back to this).

Create a git repository on site5

[remoteuser@remotehost ~]$ mkdir -p git/repo.git
[remoteuser@remotehost ~]$ cd git/repo.git
[remoteuser@remotehost ~]$ git --bare init
[remoteuser@remotehost ~]$ exit
user@host:~$ mkdir git
user@host:~$ cd git
user@host:~$ git clone ssh://remoteuser@remotehost/~/git/repo.git

Push some changes

user@host:~$ echo 'Here we go' > README
user@host:~$ git add .
user@host:~$ git commit
user@host:~$ git push

Pull changes

(someone else pushes some stuff into your repository)
user@host:~$ git pull

Start ssh-agent

user@host:~$ eval `ssh-agent`
user@host:~$ ssh-add

  • http://link guest comments

    link

  • Shae

    good sir, I would very much like to say that I am rather impressed with this blog of yours. I love how you have it set up, and wish that there were more sites that required at least a little familiarity with linux. It would greatly cut down the number of fools online. Thank you, and good luck with future prospects.

  • http://madmacak.com guest previous

    This site is pretty cool. How did you make it? How long did it take to create this?

  • http://n cad

    intresting but boring

  • Msherm2

    Thanks for this great explanation. I have gotten all the way to the point though where I created some extra files on my local machine, then added them to the local repository. When I attempt to push the files to the remote repository, I get some warnings, then it tells me To ssh:… master-> master. When I go to the remote repo though, and do a git status, it tells me it has deleted the files I intended to push from my local repo. Not sure I understand all of what is going on here.