架设 gitolite 服务器


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 ~


4. copy the public key to the home directory of git user - gitolite in remote machine.

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


5. Become the user gitolite and add the public key into the list of authorized keys so that can be used to log as this user.

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"


6. Remove the line PublickeyAuthentication "no" in /etc/ssh/sshd_config on remote machine if it exists then restart sshd


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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值