CentOS7升級Git版本


  本文記錄在CentOS 7.6上升級Git到目前最新版2.23.0。

  操作步驟參考:centos下升級git版本的操作記錄。 本文僅操作和記錄。

前言

  CentOS7上的Git版本太陳舊,在使用過程中會遇到問題,因此需要升級git版本。實時上,CentOS系統上各種軟件版本都"巨陳舊",哎...

# git --version
git version 1.8.3.1

  系統版本:(CentOS 7.6)

# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core)

安裝依賴

  源代碼安裝和編譯git,需安裝一些依賴。

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
# yum install  gcc perl-ExtUtils-MakeMaker

卸載舊版本

# yum remove git

編譯安裝Git

  Git軟件包可在此獲取https://mirrors.edge.kernel.org/pub/software/scm/git/

  我們選擇最新版的:

git-2.23.0.tar.xz                                  16-Aug-2019 20:17      5M

安裝步驟

# cd /usr/local/src/
# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.23.0.tar.xz
# tar -xvf git-2.23.0.tar.xz
# cd git-2.23.0/
# 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

驗證版本

[root@localhost ~]# git --version
git version 2.23.0

非root用戶使用

  如果是非root用戶使用git,則需要配置下該用戶下的環境變量。

$ echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
$ source ~/.bashrc

  以上,僅記錄,以備忘。

參考

  centos下升級git版本的操作記錄


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM