1、下载编译工具
yum -y groupinstall "Development Tools"
2、下载依赖包
yum -y install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel
3、下载 Git 最新版本的源代码
wget https://github.com/git/git/archive/v2.17.0.tar.gz
登录 https://github.com/git/git/releases 查看git的最新版。
不要下载带有-rc的,因为它代表了一个候选发布版本。
4、解压
tar -zxvf git-2.11.0.tar.gz
5、进入目录配置
cd git-2.13.3
./configure --prefix=/usr/local/git
注意:目录下没有configure,但有configure.am或configure.in时, 需要用autoconf命令来生成configure
make configure
6、安装
make && make install
7、配置全局路径
export PATH="/usr/local/git/bin:$PATH"
source /etc/profile
8、查看git版本
git --version
9、如果git clone出现错误
git的这个错误:fatal: Unable to find remote helper for 'https'
这是因为你没有安装(lib)curl-devel
解决办法:
yum install curl-devel
cd git-2.18.0/
./configure --prefix=/usr/local/git
make && make install
网友评论