git的初始化:
gitadmin@lightserver-GREATWALL-PC:~/teamwork.git$ git init --bare
Initialized empty Git repository in /home/gitadmin/teamwork.git/
gitadmin@lightserver-GREATWALL-PC:~/teamwork.git$
但是,到目前为止,这只是一个空仓库,空仓库是不能clone下来的。为了能做clone,我们必须先让某个有权限的人放一个初始化的版本到仓库中。
所以,我们必须先修改一下/home/git/repositories /gitosis-admin.
16.管理gitosis的配置文件
刚刚提到,gitosis本身的配置也是通过git来实现的。在你自己的开发机里,把gitosis-admin.git这个仓库clone下来,就可以以管理员的身份修改配置。
好的,我们回到另一台PC上进行对服务端的测试! 我自己的PC,名字叫:wuzhang@ubuntu
wuzhang@ubuntu:~/work$ sudo git clone root@10.255.13.253:/home/git/repositories/gitosis-admin.git
Cloning into 'gitosis-admin'...
root@10.255.13.253's password:
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5), done.
wuzhang@ubuntu:~/work$
PS:目前主机必须是root才可以克隆.
wuzhang@ubuntu:~/work/gitosis-admincdkeydir/wuzhang@ubuntu: /work/gitosis−admin/keydir ls
wuzhang@ubuntu.pub
wuzhang@ubuntu:~/work/gitosis-admin/keydir$
wuzhang@ubuntu上用户权限配置使用vi编辑器打开:
[gitosis]
[group gitosis-admin]
members = wuzhang@ubuntu
writable = gitosis-admin
members = wuzhang@10.255.13.253 light-server@10.255.13.253
[group hello]
writable = teamwork
members = lijiangkun@server b git@10.258.13.100
[group hello_ro]
readonly = teamwork
members = lz
wq! 保存退出.
这个配置文件表达了如下含义:gitosis-admin组成员有wuzhang@ubuntu, wuzhang@10.255.13.100, light-server@10.255.13.253
该组对gitosis-admin仓库有读写权限;
team组有lijinagkun@server,b两个成员.该组对teamwork仓库有读写权限;
team_ro组有lz一个成员,对teamwork仓库有只读权限
在wuzhang@ubuntu上创建一hello.txt的测试文档:
wuzhang@ubuntu:~/work/teamwork_projectecho"Testgitserver.">hello.txtwuzhang@ubuntu: /work/teamwork p roject ls -al
总用量 16
drwxrwxr-x 3 wuzhang wuzhang 4096 5月 13 18:08 .
drwxrwxr-x 4 wuzhang wuzhang 4096 5月 13 18:07 ..
drwxrwxr-x 7 wuzhang wuzhang 4096 5月 13 18:07 .git
-rw-rw-r-- 1 wuzhang wuzhang 18 5月 13 18:09 hello.txt
wuzhang@ubuntu:~/work/teamwork_project$
接下来要提交到远端服务器了。