1. 程式人生 > >centos 7 升級/安裝 git 2.7.3

centos 7 升級/安裝 git 2.7.3

 

 

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

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