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

 

相关文章:

  • 2021-11-26
  • 2021-04-13
猜你喜欢
  • 2022-01-10
  • 2021-08-16
  • 2021-08-07
  • 2021-07-17
  • 2021-09-15
相关资源
相似解决方案