搭建本地git服务器

Submitted by Lizhe on Thu, 07/20/2017 - 11:46

其实下载编译完全可以使用yum

参考一下创建文件夹和用户就可以了

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

yum install gcc perl-ExtUtils-MakeMaker

wget https://www.kernel.org/pub/software/scm/git/git-2.10.0.tar.gz

tar -zvxf git-2.10.0.tar.gz

cd git-2.10.0

make all prefix=/usr/local/git

make install prefix=/usr/local/git

echo 'export PATH=$PATH:/usr/local/git/bin' >> /etc/bashrc

source /etc/bashrc

git --version

useradd -m gituser

passwd gituser

mkdir -p /data/repositories

cd /data/repositories/ 

git init --bare test.git

chown -R gituser:gituser /data/repositories

chmod 755 /data/repositories

which git-shell


vi /etc/passwd

gituser:x:1000:1000::/home/gituser:/usr/bin/git-shell

cd ~
git clone gituser@123.207.9.138:/data/repositories/test.git