天天看點

CentOS7 安裝Git工具

分享知識 傳遞快樂

安裝依賴

git 的一些子產品依賴一些lib庫,在安裝 git 之前,須先安裝這些lib庫。

[root@contos7 tmp]# yum install gcc-c++ zlib zlib-devel openssl pcre curl-devel      

先去官網下載下傳git檔案

git-2.25.0.tar.gz      

解壓

[root@contos7 tmp]# tar -zxvf git-2.25.0.tar.gz
[root@contos7 tmp]# cd git-2.25.0      

配置

[root@contos7 tmp]# ./configure --prefix=/usr/local/git2.25.0      

編譯安裝

[root@contos7 tmp]# make
[root@contos7 tmp]# make install      

或者

[root@contos7 tmp]# make && make install      

加入環境變量

echo "export GIT_HOME=/usr/local/git2.25.0" >> /etc/profile
echo "export PATH=$GIT_HOME/bin:$PATH" >> /etc/profile
source /etc/profile      

版本檢視

[root@contos7 tmp]# git --version