Git的编译安装

Eave 2018.12.19 21:50

一、下载最新Git源代码

下载地址:https://mirrors.edge.kernel.org/pub/software/scm/git/

二、编译安装Git

yum install install autoconf automake libtool zlib-devel
wget "https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.30.0.tar.gz"
tar -zxf git-2.30.0.tar.gz
cd git-2.30.0/
make configure
./configure --prefix=/usr/local/git
make && make install

三、编辑/etc/profile文件

/etc/profile文件末尾追加一下内容
# Git
export PATH=$PATH:/usr/local/git/bin

四、出现一下错误解决办法:

git: error while loading shared libraries: libcharset.so.1: cannot open shared object file: No such file or directory

ln -s /usr/local/lib/libcharset.so.1 /usr/lib64/libcharset.so.1

git: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2
rm /usr/bin/git*
source /etc/profile