Centos下安装git高版本2.1.2

安装依赖软件

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

卸载系统自带的底版本git(1.7.1)

# git --version
git version 1.7.1
# yum remove git

编译安装最新的git版本

链接:https://pan.baidu.com/s/1YnhtIN4ZJmbcv4ohQ81Evg 密码:hgd4  //百度云下载地址,下载好放到/usr/local/src
cd /usr/local/src/

# tar -vxf git-2.1.2.tar
# cd git-2.1.2
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
# source /etc/profile

# git --version
git version git-2.1.2

======================================================================
如果是非root用户使用git,则需要配置下该用户下的环境变量

$ echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
$ source ~/.bashrc
$ git --version
git version git-2.1.2

 

可能遇到报错:utf8.c:463: undefined reference to `libiconv'

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

解决如下:

一.安装libiconv

# cd /usr/local/src
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
# tar -zxvf libiconv-1.14.tar.gz
# cd libiconv-1.14
# ./configure --prefix=/usr/local/libiconv && make && make install

二.创建一个软链接到/usr/lib

# ln -s /usr/local/lib/libiconv.so /usr/lib
# ln -s /usr/local/lib/libiconv.so.2 /usr/lib

三.然后回到git目录继续编译

# cd /usr/local/scr/git-2.8.3
# make configure
# ./configure --prefix=/usr/local --with-iconv=/usr/local/libiconv
# make
# make install

四.检查一下版本号

# git --version

 

转载于:https://www.cnblogs.com/wt645631686/p/8426506.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值