centos 安装git版本管理工具

yum -y install gcc
 
 yum install zlib-devel.x86_64

 yum install curl-devel
 
wget --no-check-certificate  https://www.kernel.org/pub/software/scm/git/git-2.10.2.tar.xz

 xz -d git-2.10.2.tar.xz
 
  tar xvf git-2.10.2.tar
   cd git-2.10.2
   ./configure
   make && make install
   
   
  $ whereis git
git: /usr/local/bin/git
$ git  --version
git version 1.7.6
$ git  --help

[root@localhost opt]# git config --global user.name "admin"
[root@localhost opt]# git config --global user.email "[email protected]"
[root@localhost opt]# git config --list
user.name=admin
[email protected]
[root@localhost opt]#

groupadd git
useradd git -g git
passwd git //修改密码

安装GIT用户管理工具Gitosis

 yum install python-setuptools.noarch
 
git clone https://github.com/tv42/gitosis.git
“Unable to find remote helper for 'https'” during git clone

 sudo -H -u git gitosis-init < ~/id_rsa.pub
OSError: [Errno 2] No such file or directory
 find / -name post-update
  chmod 755 /usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg/gitosis/templates/admin/hooks/post-update
  
  初始化gitosis管理版本库 导入管理员的公钥
 sudo -H -u git gitosis-init < ~/id_rsa.pub
 
 查看gitosis用于管理的git库
 cd /home/git/repositories/
 
 
 使用git客户端下载管理用的Git库
 
 ssh://[email protected]:4231/gitosis-admin.git
 
 gitosis.conf
 [gitosis]

#管理用的GIT目录
[group gitosis-admin]
writable = gitosis-admin
members = admin

[group liuliangbao_agent]
writable = someServierFolder #对应服务器上/home/git/repositories/下的一个目录,自动生成的,无需手动建立
members = testuser1 testuser2 #多个用户用空格隔开


keydir放pub.key值,文件名要与members里的名字一致
可以使用puttygen.exe生成公私钥对,发放给每个人
testuser1.pub
testuser2.pub

 
 
然后commit -->commit and push

相关推荐