centos 7 升级 git

最简单升级办法

yum -y install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm

yum -y install git

前置安装

yum install libcurl-dev libcurl-devel expat-devel openssl-devel  

yum install perl-ExtUtils-MakeMaker package

yum -y remove git

cd /usr/local/src/

wget https://www.kernel.org/pub/software/scm/git/git-2.15.1.tar.xz

tar -vxf git-2.15.1.tar.xz

cd git-2.15.1

make prefix=/usr/local/git all

make prefix=/usr/local/git install

echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile

source /etc/profile

git --version

保存账号

git config --global credential.helper store

遇到报错

GIT_VERSION = 2.15.1
    * new build flags
    CC credential-store.o
In file included from cache.h:4:0,
                 from credential-store.c:1:
git-compat-util.h:283:25: fatal error: openssl/ssl.h: No such file or directory
 #include <openssl/ssl.h>
                         ^
compilation terminated.
make: *** [credential-store.o] Error 1


解决办法

sudo yum install openssl-devel

遇到报错

In file included from http.c:2:0:
http.h:6:23: fatal error: curl/curl.h: No such file or directory
 #include <curl/curl.h>
                       ^
compilation terminated.
make: *** [http.o] Error 1

解决办法

yum install libcurl-dev libcurl-devel

遇到错误

[root@ignite1 git-2.15.1]# make prefix=/usr/local/git all       
    CC http.o
    CC http-walker.o
    CC http-fetch.o
    LINK git-http-fetch
    CC http-push.o
http-push.c:19:19: fatal error: expat.h: No such file or directory
 #include <expat.h>
                   ^
compilation terminated.
make: *** [http-push.o] Error 1

解决办法


yum install expat-devel

遇到错误

/usr/bin/perl Makefile.PL PREFIX='/usr/local/git' INSTALL_BASE='' --localedir='/usr/local/git/share/locale'
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2


解决办法

yum install perl-ExtUtils-Embed -y

解决yum卡住的问题

rm -f /var/lib/rpm/__db*
rpm --rebuilddb
rm -f /var/lib/rpm/.dbenv.lock
rm -f /var/lib/rpm/.rpm.lock

然后如果有运行中的yum, kill掉即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值