Git Server 安裝指南
Git Server Installation Guide
Time:2012-02-06
Author: peter tianmin
System Environment:
OS: Linux(ubuntu)
User: ghl
1. Install git, openSSH, python setuptools
$ sudo apt-get install git-core
$ sudo apt-get install openssh-server
$ sudo apt-get install openssh-client
$ sudo apt-get install python-setuptools
2.Add a new user with name “git” (manage user)
$ sudo adduser -m git
$ sudo passwd git
3. Generate Key
$ ssh-keygen -t rsa
4. Install gitosis
$ cd ~/src
$ git clone git://eagain.net/gitosis.git
$ cd gitosis
$ python setup.py install
Comments: gitosis is the administration tool for configuring git user rights.
5. Init gitosis
$ sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub
6. Modify post-update file
$ sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
7. clone gitosis
$ git clone git@127.0.0.1:gitosis-admin.git
$ cd gitosis-admin
8. Manage by gitosis and Finished
8.a How to add user for git server access?
Collect the pulic key file to gitosis-admin/keydir for each user(id_rsa.pub),
And rename the id_rsa.pub to username.pub for each user.
$ cp “path”/”username.pub” ./keydir
8.b How to configure the rights for each project/user?
$ vi gitosis.conf
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = ghl
[group foo-write]
writable = foo
members = ghl john
[group foo-read]
readonly = foo
members = rose
$ commit –am ”your comments”
$ git push
Finish!