Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux系统 > » 正文

架设 Gitolite 服务器

来源: 未知 分享至:

1. Download the source tree of gitolite which is patched by Jinag Xin, a advanced git contributer in china.

  1. git clone git://github.com/ossxp-com/gitolite.git 
2. Add a git user which is used to access git server for each clients in remote machine.
  1. 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

  1. cd ~/.ssh  
  2. ssh-keygen -t rsa -f id_rsa_gitolite  
  3. cd ~

4. copy the public key to the home directory of git user - gitolite in remote machine.
  1. scp ~/.ssh/id_rsa_gitolite.pub mygitbox
  1. ssh mygitbox
  1. sudo cp id_rsa_gitolite.pub /home/gitolite  
  2. 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.
  1. sudo su - gitolite
  1. mkdir .ssh  
  2. chmod 700 .ssh  
  3. cat id_rsa_gitolite.pub >> .ssh/authorized_keys  
  4. chmod 600 .ssh/authorized_keys  
  5. 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

  1. Host mygitbox  
  2.     User gitolite  
  3.     Hostname 10.42.43.13  
  4.     Port 22  
  5.     PreferredAuthentications publickey  
  6.     IdentityFile ~/.ssh/id_rsa_gitolite

9. Installation procedure on client machine

  1. cd gitolite/src  
  2. ./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

 


Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史