Git Server 安裝指南

tm_open 12年前發布 | 49K 次閱讀 Git 版本控制系統 git(linux-ubuntu)

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!

 本文由用戶 tm_open 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!