Server version: centos6.5
Step one: Install a git server (root user)
Just install it with yum.
Yum install-y g it
Because the CentOS default Perl is missing this module, you need to install Perl
Yum Install Perl
Create a git user
# Useradd Git
# passwd git
Installing Gitolite
Switch to a git user
# Su-git
Create bin directory
$ mkdir Bin
Download Gitolite installation package
$ git clone git://github.com/sitaramc/gitolite
Install Gitolite Source Package
$./gitolite/install-to/home/git/bin/
Now that the Gitolite installation is complete, you can view the contents of the Bin directory.
Configuring the Gitolite Administrator
Switch to root, generate the public key of the Administrator account (specify the local root user as the administrator here, type Enter to use the default value)
# Ssh-keygen
Copy the public key of administrator root to any path
# CP. ssh/id_rsa.pub/home/git/admin.pub
Switch back to git user, configure administrator for Gitolite, root
# Su-git
$/home/git/bin/gitolite Setup-pk/home/git/admin.pub
Initialized Empty Git repository in/home/git/repositories/gitolite-admin.git/
Initialized Empty Git repository in/home/git/repositories/testing.git/
WARNING:/home/git/.ssh missing; Creating a new One
WARNING:/home/git/.ssh/authorized_keys missing; Creating a new One
$ ls #新产生一个文件和一个目录
$ ls repositories/#项目仓库存放的地方, default comes with Gitolite-admin Testing.git two libraries,
Administrator Management Gitolite Warehouse
Administrator Clone Management Warehouse
# git clone [email protected]:gitolite-admin #管理员root可以无验证clone管理仓库, because the root public key admin.pub has been compiled into Gitolite, the first time after password authentication
You can do this without a secret key.
Admin Add other user--add normal user key, make secret key can be
#cp ~/.ssh/username_id_rsa.pub/root/gitolite-admin/keydir/username.pub
#cd Gitolite-admin
#git Add *
#git commit-a-M "Add Username.pub"
#git Push Origin Master
The administrator creates the warehouse and gives the user authorization
# CD Gitolite-admin/conf
# Vim Gitolite.conf
@SA = WD PC Rock #可以定义用户组
@projects = foo gitolite-admin #项目也可以分组
@admin = @project Testing #组里面还可以包含组
Repo @all # @all is a magical group that can represent all the repo, but also the users who use it,
R = @SA Gitweb Deamon # Members of @SA group are able to read all project warehouses
Repo @project #project仓库组里的所有项目对wd开所有权限
rw+ = WD
Repo Gitolite-admin #系统自带管理库必须管理员才能操作. Setup is root
rw+ = Admin
Repo Testing #系统自带test库任何人都可以操作
rw+ = @all
Repo Foo #新建的库foo
rw+ = WD #权限设置, All rights
-Master = PC #pc禁止对master分支的任何操作
RW = Woniu #woniu can read and write
R = @SA #组权限设置. Read-only
#git Add gitolite.conf
#git commit-m "added foo"
#git Push Origin Masteer
Create complete
This article is from "song" blog, please be sure to keep this source http://song1230.blog.51cto.com/5595296/1851031
Gitolite Configuring GIT server Permissions