Welcome to my blog, For more information about me, visit my website at http://www.kush.com.fj. This blog is mostly just to keep a track of my ramblings and thoughts, game reviews, and crazy hair-brained ideas, so don't expect to find any profound life altering body of knowledge here...

11/05/2014

Setting up git

Git is yet another open source version control, and seems to be the tool of choice for contemporary coding mavericks. I still prefer svn and cvs, for centralised version control, but can appreciate why some projects may require distributed repositories as afforded by git.

Setting up a central git repository on a server is easy. You basically setup a user, whose home directory is used to store the repositories, and allow access to people using keys, where the user retain their private key and their public key is saved as an authorised key for the git user account.

Note: I've documented the steps I used below for my benefit. The name of the server has been replace with <SERVER>, and the source code repository example is project.git

Set-up

groupadd git

useradd -g git -d /home/git -m git

su - git

mkdir -p /home/git/.ssh

cat id_rsa.pub > /home/git/.ssh/authorized_keys

chmod 600 /home/git/.ssh/authorized_keys

chmod 700 /home/git/.ssh

exit

vi /etc/passwd # change the shell for user git from /bin/bash to /usr/bin/git-shell