1. 服务器安装ssh,git, python-setuptools
sudo apt-get install openssh-server openssh-client
sudo apt-get install git-core
sudo apt-get install python-setuptools
2. 服务器安装gitosis
cd /tmp
#git clone git://eagain.net/gitosis.git
git clone
git clone git://github.com/res0nat0r/gitosis.git
cd gitosis
sudo python setup.py install
3. 客户端
sudo apt-get install openssh-server openssh-client
sudo apt-get install git-core
ssh-keygen -t rsa
scp .ssh/id_rsa.pub
4. 服务器配置 git服务器
创建git服务器管理用户
sudo useradd -m git
sudo passwd git
vim /etc/passwd //将git /bin/sh改为/bin/bash
sudo mkdir /home/git/repositories
sudo chown git:git /home/git/repositories
sudo chmod 755 /home/git/repositories
git config --global user.name "cjcheng"
git config --global user.email ""
5. 服务器初始化gitosis
sudo -H -u git gitosis-init < /tmp/id_rsa.pub
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
6. 客户端clone gitosis
git clone
7. 客户端创建test.git
sudo vim gitosis-admin/gitosis.conf
[group test]
members =
writable = test
提交
git add .
git commit -m "add test project"
git push origin master
mkdir test
cd test
git init
echo "hello" > readme
git add .
git commit -m "readme"
git remote add origin
git push origin master
8.另一个客户端git clone
su cjc
ssh-keygen -t rsa
exit
cp ~/.ssh/id_rsa.pub
sudo sudo vim gitosis-admin/gitosis.conf
[group test]
members =
writable = test
git add .
git commit -m "add user cjc"
git push origin master
git clone
阅读(1167) | 评论(0) | 转发(0) |