一、服務器環境html
lsb_release –a java
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.8 (Final) Release: 6.8 Codename: Final
二、安裝依賴python
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel –y
三、Git安裝</> git
1. wget https://www.kernel.org/pub/software/scm/git/git-2.5.0.tar.gz 2. tar zxvf git-2.5.0.tar.gz 3. cd git-2.5.0 4. ./configure --prefix=/usr/local/git 5. make && make install 6. ln -s /usr/local/git/bin/* /usr/bin/ 7. git --version #顯示版本號,安裝成功 8. git version 2.5.0
四、權限管理安裝github
權限管理工具gitosis的安裝,須要用到python-setuptools bash
1. yum install python python-setuptools 2. git clone git://github.com/res0nat0r/gitosis.git 3. cd gitosis/ 4. python setup.py install 5. …… 6. Using /usr/lib/python2.6/site-packages 7. Finished processing dependencies for gitosis==0.2 #安裝成功
五、管理公鑰服務器
管理Git服務器須要一個管理員,經過上傳開發者機器公鑰到服務器,添加成管理員。ssh
$ssh-keygen -t rsa #一路回車,不須要設置密碼 $scp ~/.ssh/id_rsa.pub root@10.10.105.15:~
六、Gitosis初始化curl
服務器上生成git用戶,使用git用戶並初始化gitosis,建立git版本管理用戶git工具
useradd -c "git version manager" -m -d /home/git -s /bin/bash git passwd git
初始化
mv id_rsa.pub /home/git/ su git gitosis-init < ./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 chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update #加權限