linux-cenos6.5下升级git到最新的版本

来源:互联网 发布:期货盈利交易系统优化 编辑:程序博客网 时间:2024/05/22 22:17

友情链接:
http://blog.csdn.net/auspi12341/article/details/52326187
**问题呈现:
如果使用yum自带的git版本(1.7.1版本)的话,拉取github或则gitlab上的代码时候,可能会出错误http failed****

这里写图片描述

但是呢,如果你选择ssh的话,是可以成功拉取的,但是对于laravel项目的话,其中composer的时候会出现一些问题:
(就是不使用Https拉取的话,对于一些特殊的项目比如支付类的,就会有些会拉取不下)
这里写图片描述

所以这里的最好还是要升级下git的版本到最新版本吧!!!

*首先卸载Linux自带的git
yum remove git***

下载最新git代码

wget -O git-master.zip https://github.com/git/git/archive/master.zip

编译

unzip git-master.zip
cd git-master

yum install openssl-devel curl-devel expat-devel perl-ExtUtils-MakeMaker gettext gettext-libs gettext-devel asciidoc xmlto docbook2X

ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi

错误

libgit.a(utf8.o): In function reencode_string_iconv':
/usr/local/git/utf8.c:463: undefined reference to
libiconv’
libgit.a(utf8.o): In function reencode_string_len':
/usr/local/git/utf8.c:502: undefined reference to
libiconv_open’
/usr/local/git/utf8.c:521: undefined reference to libiconv_close'
/usr/local/git/utf8.c:515: undefined reference to
libiconv_open’
collect2: ld returned 1 exit status
make: * [git-credential-store] Error 1

**从错误提示看,是缺少libiconv。
安装libiconv****

****下载编译****cd /usr/localwget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztar -zxvf libiconv-1.14.tar.gzcd libiconv-1.14./configure –prefix=/usr/local/libiconv && make && make install**创建一个软链接到/usr/lib**ln -s /usr/local/lib/libiconv.so /usr/libln -s /usr/local/lib/libiconv.so.2 /usr/lib**然后回到git目录继续编译**cd /usr/local/gitmake configure./configure –prefix=/usr/local –with-iconv=/usr/local/libiconvmakemake install*****此时,git应该编译安装成功了,测试如下:*****$ git –versiongit version 2.5.0
1 0
原创粉丝点击