哈特中尉's Blog

不会写代码的司机不是好厨师!

centos7安装git

git作为一个 分布式代码仓库,其实没有server和client的概念。

yum安装git

1
yum install -y git

查看git版本

1
git --version

卸载git

1
yum remove git

yum仓库更新不及时,目前最新的git版本可以从GitHub下载安装。

下载安装文件

https://github.com/git/git/releases
https://www.kernel.org/pub/software/scm/git

1
wget https://github.com/git/git/archive/v2.13.3.tar.gz

解压当前目录

1
tar -xzvf v2.13.3.tar.gz

安装必要依赖

1
yum  -y install  cpio curl curl-devel zlib-devel openssl-develexpat-devel gettex-devel build-essential tcl8.4 tk8.4 gettext vim openssh-clients setuptoolntsysv system-config-securitylevel-tui system-config-network-tui wget man gccgcc-c++ gcc-g77 flex autoconfig automake bison zlib-devel bzip2-develncurses-devel libtool libtool-ltdl openssl openssl-devel pam-devellibtermcap-devel curl-devel libxml2-devel libevent libevent-devel gettext-develexpat-devel
1
2
3
4
5
6
7
8
9
10
11
yum -y update
yum -y install gcc automake autoconf libtool make
yum -y install gettext
yum -y install zlib zlib-devel
yum -y install expat-devel
yum -y install perl-ExtUtils-MakeMaker package
yum -y install libcurl-devel.x86_64
yum -y install expat-devel.x86_64
yum -y install asciidoc
yum -y install sgml2xml openjade texinfo xmlto asciidoc perl perl-devel
yum -y install perl-XML-SAX.noarch
1
2
3
rpm -ivh http://springdale.math.ias.edu/data/puias/unsupported/7/x86_64//docbook2X-0.8.8-17.sdl7.x86_64.rpm
cd /usr/bin
ln -s db2x_docbook2texi docbook2x-texi

安装

1
2
3
4
5
6
cd git-2.13.3
make configure
./configure --prefix=/usr/local/ --with-curl --with-expat
make
#make prefix=/usr/local install-doc install-html install-info
make install

查看安装结果

1
git --version

附:安装git命令补齐功能

1
2
3
# rpm –ivh http://mirror.1000mbps.com/fedora-epel/6Server/x86_64/bash-completion-1.3-7.el6.noarch.rpm
# cp contrib/completion/git-completion.bash /etc/bash_completion.d/
# source /etc/bash_completion