1. Download the source tree of gitolite which is patched by Jinag Xin, a advanced git contributer in china.
2. Add a git user which is used to access git server for each clients in remote machine.
sudo adduser --system --shell /bin/bash --gecos 'git version control' --group --disabled-password --home /home/gitolite gitolite
3. Back to the client and create a key pairs
cd ~/.ssh
ssh-keygen -t rsa -f id_rsa_gitolite
cd ~
scp ~/.ssh/id_rsa_gitolite.pub mygitbox
ssh mygitbox
sudo cp id_rsa_gitolite.pub /home/gitolite
sudo chown gitolite:gitolite /home/gitolite/id_rsa_gitolite.pub
sudo su - gitolite
mkdir .ssh
chmod 700 .ssh
cat id_rsa_gitolite.pub >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
rm id_rsa_gitolite.pub
If you are using debian, above commands can be replaced by "ssh-copy-id gitolite@server"
7. Remove the line PublickeyAuthentication "no" in /etc/ssh/ssh_config on client machine
8. Modify ~/.ssh/config
Host mygitbox
User gitolite
Hostname 10.42.43.13
Port 22
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_gitolite
9. Installation procedure on client machine
cd gitolite/src
./gl-easy-install gitolite mygitbox gitadmin
.ssh/authorized_keys will rename to old_authkeys and re-generate authorized_keys
New ~/.ssh/config shows:
10. Done