Skip to content

Instantly share code, notes, and snippets.

@zhangludi
Last active August 15, 2018 03:39
Show Gist options
  • Save zhangludi/5fc416b2e5da920d27e8024cb39dfd62 to your computer and use it in GitHub Desktop.
Save zhangludi/5fc416b2e5da920d27e8024cb39dfd62 to your computer and use it in GitHub Desktop.
How To Install Git on CentOS 7
来源: https://www.digitalocean.com/community/tutorials/how-to-install-git-on-centos-7
Option One — Install Git with Yum
简单安装发现版本为1.8 但是git新版本到了2
sudo yum install git
git --version
Option Two — Install Git from Source
sudo yum groupinstall "Development Tools"
sudo yum install gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel
查看: https://github.com/git/git/releases
wget https://github.com/git/git/archive/v2.1.2.tar.gz -O git.tar.gz
tar -zxf git.tar.gz
cd git-*
make configure
./configure --prefix=/usr/local
sudo make install
git --version
发现还是1.8
yum remove git
安装 Git
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
添加到环境变量
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc # 实时生效
git --version
版本到了2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment