1. 程式人生 > >git安裝--linux下的安裝

git安裝--linux下的安裝

pre utils /etc/ conf 可能 重要 開發 ive archive

一般linux自帶git版本很舊,會有一定問題,可以先卸載系統自帶git:

yum remove git
下載及安裝git:

wget https://github.com/git/git/archive/v2.2.1.tar.gz
tar zxvf v2.2.1.tar.gz
cd git-2.2.1
make configure
./configure --prefix=/usr/local/git/ --with-iconv=/usr/local/libiconv --with-curl=/home/{username}/curl/
make
make install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc


配置curl很重要。
可能出現的問題,少一些系統庫:
1.編譯git時報錯: zlib.h: No such file or directory
缺少 zlib的頭文件, 開發包沒裝,

yum install zlib (系統默認已經裝上)
yum install zlib-devel

解決

2.提示make cc Command not found

yum install gcc
3.make[1]: * [perl.mak] Error 2 make: * [perl/perl.mak] Error 2
執行:

yum install perl-ExtUtils-MakeMaker package.
進行安裝
出現錯誤二:
/bin/sh: msgfmt: command not found

yum install gettext-devel
可解決!

4./bin/sh: line 1: asciidoc: command not found
安裝asciidoc:
到官網下載asciidoc
http://www.methods.co.nz/asciidoc/index.html
http://sourceforge.net/projects/asciidoc/

cp asciidoc-8.5.2.tar.gz /root/src
cd /root/src
tar xvfz asciidoc-8.5.2.tar.gz
cd asciidoc-8.5.2
./configure
sudo make install
5./bin/sh: line 1: xmlto: command not found

yum install xmlto
6.如果出現http/https異常,安裝curl

git安裝--linux下的安裝