centos7下git版本升级

Posted qtiger

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7下git版本升级相关的知识,希望对你有一定的参考价值。

centos系统自带的git版本过低,当使用git拉取、推送、克隆的时候可能会报错,常见的错误:

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

所以有必要将git版本升级。

 

查询git版本信息:命令git --version

技术分享图片

 

 接下来就是介绍git版本升级的操作:(注意标紫的文字)

0)安装依赖包
[[email protected] ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
[[email protected] ~]# yum install  gcc perl-ExtUtils-MakeMaker
 
1)卸载系统自带的低版本git(1.8.3)
[[email protected] ~]# git --version
git version 1.8.3
[[email protected] ~]# yum remove git
  
2)编译安装最新的git版本
[[email protected] ~]# cd /usr/local/src/
[[email protected] src]# wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.xz     下载git-2.7.3.tar.xz压缩包
[[email protected] src]# tar -vxf git-2.7.3.tar.xz   解压缩
[[email protected] src]# cd git-2.7.3     
[[email protected] git-2.7.3]# make prefix=/usr/local/git all  编译
[[email protected] git-2.7.3]# make prefix=/usr/local/git install  安装
[[email protected] git-2.7.3]# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile 加git到环境变量
[[email protected] git-2.7.3]# source /etc/profile  
[[email protected] ~]# git --version
git version 2.7.3
  
======================================================================
 
 
 
在服务器centos系统上完成git升级后,接下来在服务器上安装GITLAB,请参考漠效的博客https://blog.csdn.net/gx_1_11_real/article/details/79406427

以上是关于centos7下git版本升级的主要内容,如果未能解决你的问题,请参考以下文章

如何管理在每个 git 版本中添加私有代码片段?

centos7源码安装git2.10.0版本

centos 7.4 部署并升级gitlab

CentOS7 下升级Python版本

centos7下git服务器端搭建

centOS7.2下 搭建gitlab使用git为团队管理代码