================================================================================
1. 查看gitosis,这是我的git库。
[服务器端192.168.18.115],用户root
工作路径:
root@android-server:/workdisk/gitrepo#
# ls
g51_mtk6735_code3.git mtk6572.git mtk6572_v4.4_chen.git mtk6735.git temp.txt
gitosis-admin.git mtk6572_v350_jb3.git mtk6572_v4.4.git mtk6735_v5.1.git test_mtk6735_code.git
# ls gitosis-admin.git/
config gitosis.conf gitosis-export HEAD hooks index info objects refs
# ls gitosis-admin.git/gitosis-export/keydir/
albert@android-server.pub cbh@android-server.pub lxg@android-server.pub lxglxt@lxglxt-android.pub
================================================================================
2. 生成密钥与公钥
[客户端192.168.18.169],用户lxglxt
查看是否已经有了ssh密钥:ls ~/.ssh
如果没有密钥则不会有此文件夹,有则跳过下一步的生成过程
生成密钥:
$ ssh-keygen -t rsa
按3个回车,密码为空
================================================================================
3. 获取并配置gitosis-admin
[客户端192.168.18.169],用户albert@android-server
工作路径:/home/albert
因为用户albert已经有权限,所以借用下
$ git clone git@192.168.18.115:/gitosis-admin.git
$ cd gitosis-admin
$ ls
gitosis.conf keydir
编辑文件
$ vi gitosis.conf
[group v8_v4.4_chen]
members = albert@android-server cbh@android-server lxg@android-server lxglxt@lxglxt-android
writable = mtk6572_v4.4_chen
[group g51_code_3]
members = albert@android-server cbh@android-server lxg@android-server lxglxt@lxglxt-android
writable = g51_mtk6735_code3
添加lxglxt的ssh公钥文件
$ cp -v /home/lxglxt/.ssh/id_rsa.pub keydir/lxglxt@lxglxt-android.pub
提交
$ git add .
$ git commit -a -m 'add new user lxglxt'
$ git push
================================================================================
4. 在客户端测试使用git
[客户端192.168.18.169],用户lxglxt
git clone git@192.168.18.115:/mtk6735_code.git
阅读(5461) | 评论(0) | 转发(0) |