*如果已安装libiconv,可以直接进入第三步
一、安装libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar -zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/libiconv && make && make install
二、创建软链接
ln -s /usr/local/lib/libiconv.so /usr/lib
ln -s /usr/local/lib/libiconv.so.2 /usr/lib
三、安装git
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.37.3.tar.gz
tar -zxvf git-2.37.3.tar.gz
cd git-2.37.3
make configure
./configure --prefix=/usr/local --with-iconv=/usr/local/libiconv && make && make install
需要其他版本可在git官网下载:https://mirrors.edge.kernel.org/pub/software/scm/git/
四、检查安装结果
git --version
遇到问题:
1、使用gitee仓库,每次clone或pull等操作远程仓库时,需要输入账号密码
使用以下命令:
git config --global credential.helper store
使用后首次提交的时候输入一次帐号和密码之后就不需要再次输入了;
2、编译时出现报错:undefined reference to `locale_charset'
git解压包下找到Makefile文件
vim Makefile
找到 EXTLIBS += $(ICONV_LINK) -liconv
改为 EXTLIBS += $(ICONV_LINK) -liconv -lcharset //保存退出
重新make
make install