服务器系统:Centos 6 (查看centos版本命令:lsb_release -a)
客户端系统:Windows 7
一、服务器端安装Git
==通常centos上使用yum源安装的git版本过低==
1. 检查系统上是否已经安装git,若已有则卸载
// 查看当前git版本# git --version git version 1.7.1// 卸载旧版本# yum remove -y git
2. 安装依赖包,下载最新版本git源码
# yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel # wget https://github.com/git/git/archive/v2.13.2.tar.gz# tar zxf v2.13.2.tar.gz
3. 安装git,配置环境变量
# cd git-2.13.2 # make prefix=/usr/local/git all # make prefix=/usr/local/git install # echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc # source /etc/bashrc // 实时生效
4. 查看git版本号,正确显示则安装成功
# git --version git version 2.13.2
5. 若编译时报错如下
libgit.a(utf8.o): In function `reencode_string_iconv':/usr/local/src/git-2.13.2/utf8.c:463: undefined reference to `libiconv' libgit.a(utf8.o): In function `reencode_string_len':/usr/local/src/git-2.13.2/utf8.c:524: undefined reference to `libiconv_open' /usr/local/src/git-2.13.2/utf8.c:535: undefined reference to `libiconv_close' /usr/local/src/git-

