DevOps之三 Git的安装与配置

Centos7 安装Git

一、卸载Centos7 自带的git

# git --version
git version 1.8.3.1

# whereis git
git: /usr/bin/git /usr/share/man/man1/git.1.gz

# yum remove git

# git --version

  -bash: /usr/bin/git: 没有那个文件或目录

二、下载最新版的git,下载地址:https://www.kernel.org/pub/software/scm/git/

# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.0.5.tar.gz
# tar xzf git-2.0.5.tar.gz

三、修改环境变量

编译git
./configure --prefix=/usr/local/git-2.12.2
sudo vim /etc/profile

export Git_HOME=/usr/local/git-2.12.2/
source /etc/profile

四、查看版本

# git --version
原文地址:https://www.cnblogs.com/wuwei928/p/8079440.html