centos8安装git

86 阅读1分钟

1.下载git

  • 官方推荐 CentOS 通过下载 git 源码包的方式去安装
  • 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.
  • 执行命令
  • mirrors.edge.kernel.org/pub/softwar…
  • 下载最新版
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
  1. 解压缩安装
  • 安装前,先安装依赖环境
  yum install -y perl-devel
  • 解压缩
tar -zxvf git-2.9.5.tar.gz
  • 配置环境安装
cd git-2.9.5

// 注意替换安装目录
./configure --prefix=/usr/git

make && make install
  • 添加到系统变量(注意替换安装目录)
vim ~/.bashrc
export PATH="/usr/git/bin:$PATH"
source ~/.bashrc
  • 查看版本号
git version