centos7 安装Git

centos7 安装Git

Git 的工作需要调用 curl,zlib,openssl,expat,libiconv 等库的代码,所以需要先安装这些依赖工具。

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

查看新版本https://mirrors.edge.kernel.org/pub/software/scm/git/

下载git

wget https://www.kernel.org/pub/software/scm/git/git-2.16.3.tar.gz

编译并安装:

tar -zxf git-2.16.3.tar.gz
cd git-2.16.3.tar.gz
make prefix=/usr/local all
sudo make prefix=/usr/local install

加入环境变量

echo “export PATH=$PATH:/usr/git/bin” >> /etc/profile
source /etc/profile

检查版本

git –version

你可能感兴趣的:(其他)