运维开发网

centos 7 升级/安装 git 2.7.3

运维开发网 https://www.qedev.com 2020-05-06 13:13 出处:网络 作者:运维开发网整理
  1、安装所需软件包 # yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel # yum install gcc perl-ExtUtils-MakeMaker
 

1、安装所需软件包

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel # yum install gcc perl-ExtUtils-MakeMaker

2、下载&安装

# cd /usr/src # wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.gz # tar xzf git-2.7.0.tar.gz
# cd git-2.7.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

ln -s /usr/local/git/bin/git /usr/bin/git

3、检查版本

# git --version

$ git config --global user.name "gb"
$ git config --global user.email [email protected]
 

o、其他

centos自带Git,7.x版本自带git 1.8.3.1(应该是,也可能不是),安装新版本之前需要使用yun remove git卸载(安装后卸载也可以)。

执行make prefix=/usr/local/git all时,可能会报错:make: * [git-credential-store] Error 1,此时可以使用以下命令代替

# ./configure --without-iconv # make CFLAGS=-liconv prefix=/usr/local/git all # make CFLAGS=-liconv prefix=/usr/local/git install
0

精彩评论

暂无评论...
验证码 换一张
取 消