Linux编译安装Git

方法一:

cd ~ 
sudo mkdir /soft
sudo chown erge /soft
sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev \
gettext libz-dev libssl-dev asciidoc xmlto docbook2x \
install-info  getopt
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
tar zxvf git-2.18.0.tar.gz
cd git-2.18.0/
make configure
./configure --prefix=/soft/git
make all doc info
make install install-doc install-html install-info


方法二:

yum install curl-devel expat-devel gettext-devel   openssl-devel zlib-devel
首先用软件管理器安装以上依赖软件 
下载好git

wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz

tar -zxvf git-2.9.5.tar.gz 
(在下载目录下解压就可以了,然后安装编译到其他目录)

cd git-2.9.5

make prefix=/usr/local/git all
make prefix=/usr/local/git install

或者使用另一种方式,当前目录下
./configure prefix=/usr/local/git

(配置文件)
make && make install
(编译安装)

编译有可能没有成功,请通过错误提示自行百度
安装成功
编译成功后,表示git安装成功,这时可以查看git版本号,确认是否成功

cd /usr/local/git/bin
git --version
 

你可能感兴趣的:(git,Reference)