Posted on 2011-05-26 15:46
贝贝爸爸 阅读(3298)
评论(0) 编辑 收藏
#yum install python python-setuptools
1 ##下载gitosis仓库到本地
2 # git clone git://eagain.net/gitosis.git gitosis
3
4 #安装 yum install python-setuptools
5 # python setup.py install --record uninstall.txt #记录需要卸载的东西
6
7 #导入初始化公钥
8 # su git
9 [git@dev01 gitosis]$ gitosis-init < /tmp/id_rsa_yuan.pub
10 Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
11 Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
12
13 #进入自己设置的git仓库路径
14 # cd /var/git/
15 [root@dev01 git]# ln -s /home/git/repositories/ repo
16 #改变文件权限
17 [root@dev01 git]# chmod 755 /var/git/repo/gitosis-admin.git/hooks/post-update
18
19 -----------------------
20 回到本机测试一下ssh连接
21 $ ssh git@192.168.250.231
22 ERROR:gitosis.serve.main:Need SSH_ORIGINAL_COMMAND in environment.
23 Connection to 192.168.250.231 closed.
24
25 ##大功告成,说明gitosis生效
#首先clonegitosis-admin项目到本地
$ git clone git@192.168.250.231:gitosis-admin.git
Cloning into gitosis-admin
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5), done.
啊啊
#修改查看到gitosis.conf
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = yuan
[group eontime]
writable = costdb \
oryx-editor \
demo/test
members = yuan
#如上所示,分有2个组类型admin和我们自定义的,你可以随便定义一个组,其实就是个权限集合
#writable意思是,这个权限组有哪几个项目的写权限?这里是空格分开,如果太长就换行,例如demo/test的话,就是:
git remote add origin git@gitserver:demo/test.git
members就是有这个权限的组成员了,通过把有权限的开发者的公钥上传至keydir
最后将gitosis-admin提交至远程
#git push remote origin master
ok,一切完成,服务端将同步有一个仓库了。