遇到此類問題一般是缺乏對應的庫文件。linux
因爲yum install是老版本的git 仍是1.8的 若是須要安裝新版本的git,官方給出的url:https://git-scm.com/download/linuxgit
centos 須要下載對應源代碼包,而後編譯安裝。centos
./configure make
執行make的時候報錯,cache.h:40:18: 致命錯誤:zlib.h:沒有那個文件或目錄bash
安裝zlibide
yum install zlib #此時敲Tab會自動補全
zlib-ada-devel.x86_64 zlib-devel.i686 zlib-static.i686
zlib-ada.x86_64 zlib-devel.x86_64 zlib-static.x86_64ui
安裝對應的就行 我安裝的是 this
yum install zlib-devel.x86_64
接着編譯url
make && make install
git version # 查看版本號
git version 2.9.5
spa
-------------------------其餘版本安裝---------------------------------------code
Download for Linux and Unix
It is easiest to install Git on Linux using the preferred package manager of your Linux distribution. If you prefer to build from source, you can find the tarballs on kernel.org.
Debian/Ubuntu
For the latest stable version for your release of Debian/Ubuntu
# apt-get install git
For Ubuntu, this PPA provides the latest stable upstream Git version
# add-apt-repository ppa:git-core/ppa
# apt update; apt install git
Fedora
# yum install git
(up to Fedora 21)
# dnf install git
(Fedora 22 and later)
Gentoo
# emerge --ask --verbose dev-vcs/git
Arch Linux
# pacman -S git
openSUSE
# zypper install git
Mageia
# urpmi git
Nix/NixOS
# nix-env -i git
FreeBSD
# pkg install git
Solaris 9/10/11 (OpenCSW)
# pkgutil -i git
Solaris 11 Express
# pkg install developer/versioning/git
OpenBSD
# pkg_add git
Alpine
$ apk add git
Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.
RHEL and derivatives typically ship older versions of git. You can download a tarball and build from source, or use a 3rd-party repository such as the IUS Community Project to obtain a more recent version of git.
Slitaz
$ tazpkg get-install git