setup git server on centos 5

# Install Git on git.zhenglei.net
yum install expat-devel zlib-devel gettext-devel openssl-devel
unzip git-1.7.2.5.zip
cd git-1.7.2.5
make prefix=/usr/local install

## Create empty repository of test.git in /repo of git.zhenglei.net
mkdir /repo
cd /repo
GIT_DIR=test.git git init
cd test.git
git –bare update-server-info
cp hooks/post-update.sample hooks/post-update

## Access git.zhenglei.net via port XXXX over ssh
# Config ssh on workstation
echo “Host git.zhenglei.net” >>~/.ssh/config
echo “hostname git.zhenglei.net”>>~/.ssh/config
echo port XXXX >>~/.ssh/config

## Clone test.git
git clone ssh://root@git.zhenglei.net/repo/test.git

## Add README in local
cd test
touch README
git add README
git commit -m “add readme”

## Push back to server
git push origin master