Recently, I set up a Git server for my team. The path is tortuous and I wrote it down for query. The Centos6.4 64-bit version is used for internal servers.
Install Git
Install git
First install the required git Library:
Yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
Download the Git installation file
Wget http://git-core.googlecode.com/files/git-1.9.0.tar.gz
Install
Tar zxvf git-1.9.0.tar.gz
Cd git-1.9.0
Make prefix =/usr/local all
Make prefix =/usr/local install # run as the root user
Install gitolite
First create a user git and generate an ssh-key
// Create a git User and user group and create a user folder
Sudo useradd-c 'Git version manage'-m-d/home/git-s/bin/bash -- users-group git
// Change the password
Passwd git
// Generate the ssh-key of git
Su git
Ssh-keygen-t rsa-C "your name"
Ssh-copy-id git@127.0.0.1
Enter ssh git@127.0.0.1 to see if password-free login is possible. Download gitolite
Git clone git: // github.com/sitaramc/gitolite
Start Installation
Mkdir bin
~ /Gitolite/install-~ /Bin
Mv ~ /. Ssh/authorized_keys ~ /Git. pub
~ /Bin/gitolite setup-pk ~ /Git. pub
Two versions of libraries/home/git/repositories/gitolite-admin.git/home/git/repositories/testing. git are initialized to test whether the installation is successful.
Ssh git@127.0.0.1
If the output is as follows, the operation is successful:
Hello git, this is git @ linux-dev running gitolite3 v3.5.2-4-g62fb317 on git1.8.1.2
R w gitolite-admin
R w testing
Add administrator key
Git clone git@127.0.0.1: gitolite-admin.git
Generate an ssh public key on the development machine, upload it to the gitolite-admin/keydir directory, and name it with the user name.
Scp ~ /. Ssh/id_rsa.pub git @ server:/tmp/id_rsa.pub
Edit the configuration file:
@ Admin = admin git
@ All = admin dev1 dev3 dev2
Repo pub/CREATOR/. + $
C = @ all
RW + = CREATOR
RW = WRITERS
R = READERS @ admin
Repo gitolite-admin
RW + = @ admin
Repo testing
RW + = @ all
After the configuration is complete and submitted, each user can create a repository and assign permissions under the corresponding user name Directory.