Environment:
System hardware: VMware vsphere (cpu:2*4 core, memory 2G, dual NIC)
System version: Centos-7.0-1406-x86_64-dvd.iso
Server ip:192.168.1.31 domain name: www.domain.com SSH Port: 8200 (default = 22)
Installation steps:
1. Display the server version
[Email protected] ~]# cat/etc/redhat-release
#CentOS Linux release 7.0.1406 (Core)
[Email protected] ~]# uname-a
#Linux tCentos7 3.10.0-123.9.3.el7.x86_64 #1 SMP Thu Nov 6 15:06:03 UTC x86_64 x86_64 x86_64 gnu/linux
[email protected] ~]# ipconfig
#服务器IP192.168.1.31
2. Install git
#2.1 Downloads git-2.2.0.tar.gz to/usr/local/src
[Email protected] ~]# CD/USR/LOCAL/SRC
[Email protected] ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.2.0.tar.gz
#2.2 Installing a dependent library
[email protected] ~]# Yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
#2.3 Delete the original installed Git
[email protected] ~]# Yum Remove git-y
#2.4 Compiling the installation
[Email protected] ~]# CD/USR/LOCAL/SRC
[Email protected] ~]# TAR-ZVXF git-2.2.0.tar.gz
[Email protected] ~]# CD git-2.2.0
[[email protected] ~]# make prefix=/usr/local/git all
[[email protected] ~]# make Prefix=/usr/local/git Install
#2.5 Adding soft connections
[Email protected] ~]# ln-s/usr/local/git/bin/*/usr/bin/
[[email protected] ~]# git--version
#如何能显示版本号, that means success.
3. Installing Gitosis
[email protected] ~]# Yum install python python-setuptools
[Email protected] ~]# CD/USR/LOCAL/SRC
[[email protected] ~]# git clone git://github.com/res0nat0r/gitosis.git
[Email protected] ~]# CD gitosis
[[email protected] ~]# python setup.py install
#显示Finished processing dependencies for gitosis==0.2 indicates success
*******************************************************
4. Modify the client Git connection port (if the GIT server is the default SSH port of 22, the following steps are not required)
#修改开发机客户端配置文件 (can omit each input port)
[Email protected] ~]# mkdir ~/.ssh
[Email protected] ~]# vim ~/.ssh/config
#打开后, edit the file, add the following code
Host www.domain.com
Hostname www.domain.com
Port 8200
#修改后, the development machine client can access the connection in the following ways
#git Clone Ssh://[email Protected]/gitosis-admin.git
#否则需要需要加上端口进行访问
#git Clone Ssh://[email Protected]:8200/gitosis-admin.git
*******************************************************
5. On the development machine client, generate the key and upload it to the server
SSH-KEYGEN-T RSA
#一路回车, you do not need to set a password
#从开发机客户端, upload the public key that you just generated to the server (if you modify the port, configure the specified port by 4)
SCP ~/.ssh/id_rsa.pub [Email protected]:/tmp/
#显示已经上传的密钥
[Email protected] ~]# ls/tmp/id_rsa.pub
6. Generate GIT users on the server, use git user and initialize Gitosis
#6.1 Add git users
[[email protected] ~]# adduser-m git
#6.2 Switching users
[Email protected] ~]# Su-git
#6.3 The server's public key (just before the development machine client uploads), the developer client can manage the GIT server after the import.
[Email protected] ~]# Gitosis-init </tmp/id_rsa.pub
#显示以上信息即表示成功
#Initialized Empty Git repository in/home/git/repositories/gitosis-admin.git/
#Reinitialized existing Git repository in/home/git/repositories/gitosis-admin.git/
#6.4 Delete key
[Email protected] ~]# Su-root
[Email protected] ~]# rm-rf/tmp/id_rsa.pub
6. In the development machine client, copy the GIT management project (GIT server management, also a git repository)
Mkdir-p/repo
Cd/repo
git clone [email protected]:gitosis-admin.git
7. Adding and setting up management projects in the development machine client
Cd/repo/gitosis-admin
#查看已经上传密钥
LS Keydir
Cat keydir/vicowong\ @VICO. Pub #[email protected] for the uploaded dev machine
#显示密钥最后的符串为密钥用户名 here for [email protected]
Vim gitosis.conf
#在文件尾增加以下内容
[Group Test-git] # groups Name
writable = test-git # project Name
Members = [email protected] #密钥用户名
#提交修改
git Add.
Git commit-a-M "Add test-git repo"
git push
9. In the development machine client, initial, add and use Project Test-git
Cd/repo
mkdir Test-git
CD Test-git
Git inti
Touch Readme
git Add.
Git commit-a-M "Init Test-git"
git remote add origin [email protected]:test-git.git
Git push Origin Master
CentOS Install git server CentOS 7.0 + git 2.2.0 + gitosis (measured notes)