概述

Gitosis是一个为托管Git存储库提供访问控制和远程管理的工具;它允许通过SSH进行细粒度的读写访问管理,而不要求用户在服务器上拥有本地系统帐户.为此,它设置一个单一的系统帐户"git",然后用于所有Git访问

安装配置

安装git

yum install git

安装ssh

yum install openssh

创建帐号

useradd -m git

创建仓库存储目录

mkdir /home/git/repo

修改仓库存储目录访问权限

chmod 700 /home/git/repo

安装python-setuptools

yum install python-setuptools

下载gitosis

git clone https://github.com/tv42/gitosis.git
cd gitosis
sudo python setup.py install

克隆gitosis的管理项目

git clone ssh://git@hostname:9999/gitosis-admin.git

由于修改了ssh的默认端口,所以需要标明ssh://和端口

卸载
Clone the gitosis git repository again and then install it again using the --record option:

sudo python setup.py install --record uninstall.txt

Which will produce a text file containing all the installed files. Then just delete them.

sudo cat uninstall.txt | sudo xargs rm -rf

You may want to remove the git user:

sudo userdel -f git

as well as the git group:

sudo groupdel [git]

The ssh configuration consists in entries in the .ssh/authorized_keys which is going to be deleted along with the git user home directory.