1. 程式人生 > >centos7下git版本升級

centos7下git版本升級

version scm remove ima perl ack software open index

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)安裝依賴包 [root@localhost ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
[root@localhost ~]# yum install gcc perl-ExtUtils-MakeMaker 1)卸載系統自帶的低版本git(1.8.3) [root@localhost ~]# git --version git version 1.8.3 [root@localhost ~]# yum remove git 2)編譯安裝最新的git版本 [root@localhost ~]# cd /usr/local/src/ [root@localhost src]# wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.xz 下載git-2.7.3.tar.xz壓縮包
[root@localhost src]# tar -vxf git-2.7.3.tar.xz 解壓縮 [root@localhost src]# cd git-2.7.3 [root@localhost git-2.7.3]# make prefix=/usr/local/git all 編譯 [root@localhost git-2.7.3]# make prefix=/usr/local/git install 安裝 [root@localhost git-2.7.3]# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile 加git到環境變量
[root@localhost git-2.7.3]# source /etc/profile [root@localhost ~]# git --version git version 2.7.3 ====================================================================== 在服務器centos系統上完成git升級後,接下來在服務器上安裝GITLAB,請參考漠效的博客https://blog.csdn.net/gx_1_11_real/article/details/79406427

centos7下git版本升級