> cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
- 必须先安装gcc、g++
- 推荐使用安装包安装
使用安装包安装
- 下载依赖
########## Centos/RedHat ##########
$ sudo dnf install dh-autoreconf curl-devel expat-devel gettext-devel \
openssl-devel perl-devel zlib-devel
- 下载安装包
$ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.29.0.tar.gz
- 解压、安装、配置
$ tar -xvf git-2.29.0.tar.gz
$ cd git-2.29.0/
$ ./configure --prefix=/usr
$ make all
$ make install
- 是否安装成功
$ git version
git version 2.29.0
可以使用yum进行安装(不建议安装,因为版本太低了)
-
查看yum源仓库Git信息:yum info git
-
安装git:yum install git
yum install git
- 查看版本信息:
> git --version
git version 1.8.3.1
- 查看git版本,如果默认安装的版本过低,移除默认安装的git
yum remove git
https://git-scm.com/book/zh/v2
https://www.runoob.com/git/git-install-setup.html