Centos下升级git版本

1、升级原因

在使用git pull、git push、git clone的时候,或者在使用jenkins发版的时候,可能会报类似如下的错误: 


error: The requested URL returned error: 401 Unauthorized while accessing https://git.oschina.net/zemo/demo.git/info/refs 
fatal: HTTP request failed

像centos7.5一般自带的git都是1.8.3.1版本的,比较老了,所以有时候需要升级一下git版本

2、笔者测试环境为

3、安装依赖软件

[root@localhost test1]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc

[root@localhost test1]# yum install  gcc perl-ExtUtils-MakeMaker

4、卸载系统自带的低版本git

[root@localhost test1]#  git --version

[root@localhost test1]# yum remove git

5、编译安装最新的git版本

[root@localhost test1]#  cd /usr/local/src/

[root@localhost test1]#  wget https://www.kernel.org/pub/software/scm/git/git-2.15.1.tar.xz

[root@localhost test1]#  tar -vxf git-2.15.1.tar.xz

[root@localhost test1]#  cd git-2.15.1

[root@localhost test1]#  make prefix=/usr/local/git all

[root@localhost test1]#  make prefix=/usr/local/git install

[root@localhost test1]#  echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile

[root@localhost test1]#  source /etc/profile

[root@localhost test1]#  git --version

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

桂安俊@kylinOS

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值