前言
今天在我的centos7.2开发环境安装git2.x时候遇到了各种问题,还好一一解决,为方便大家,这里列出遇到的问题和解决办法,yum默认安装的git1.8版本的,公司git服务器在windows搭建的,使用1.8的git一直提示认证失败。网管说得更新到2.x,于是于是就有了今天的问题。
安装
从github获取最新的release版本源码:
wget https://github.com/git/git/archive/v2.11.0.tar.gz
解压到当前目录
tar -zxvf git-2.11.0
编译执行make指令
1.报如下错误:
warning: expat.h: No such file or directory
解决办法:
yum install expat-devel
2.报如下错误:
http.h:6:23: 致命错误:curl/curl.h:没有那个文件或目录
#include <curl/curl.h>
yum install libcurl-devel
3.报如下错误:
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** Error 2
make: *** Error 2
解决办法:
yum install perl-ExtUtils-MakeMaker package
编译安装:
make
make install
大功告成: