Setup Git server with gitolite on Ubuntu 12.04

Here is my quick note of setting up git server and create new repo

# on client
# generate ssh key
ssh-keygen -t rsa
scp ~/.ssh/ [user]@[server]:/tmp/[user].pub
# on server
apt-get install git
apt-get install gitolite
adduser --disabled-password gitolite

su - gitolite
gl-setup /tmp/[user].pub
# on client
apt-get install git
git config --global "[name]"
git commit --global "[email]"
git clone gitolite@git:gitolite-admin.git
cd gitolite-admin/conf/
vi gitolite.conf

# add hello repo into the file
repo    hello
        RW+     =   @all

# commit & push
git add gitolite.conf
git commit
git push
# work on new project hello
git clone gitolite@git:hello
cd hello
touch README
git add README
git commit
git push origin master

To reset the repositories

su - gitolite
rm /home/gitolite/projects.list
rm -rf /home/gitolite/repositories
gl-setup /tmp/[user].pub