一、安装最新版git
(1)安装依赖包
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install gcc perl-ExtUtils-MakeMaker
(2)卸载旧的git版本
# yum remove git
(3)查看最新git版本号
登录https://www.kernel.org/pub/software/scm/git/
当前最新版为2.9.0
(4)下载&解压
# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz
# tar -zxvf git-2.9.0.tar.gz
(5)编译安装
# cd git-2.9.0
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc
(6)检查git版本
# git --versiongit
version 2.9.0
二、配置SSH免密码登录
(1)创建一个git用户,用来运行git服务
# adduser git
(2)初始化git仓库,这里我们选择创建在/data/git/目录下
# cd /
# mkdir /data
# cd data
# mkdir /git
# cd git
# git init --bare XXXXX.git
(3)owner改为git
# chown git:git XXXXX.git
(4)将RSA认证打开
a:
# vim /etc/ssh/sshd_config
b:对应内容修改如下
1.RSAAuthentication yes
2.PubkeyAuthentication yes
3.AuthorizedKeysFile .ssh/authorized_keys (责任编辑:最模板) |