Detailed explanation of how to install git on centos

藏色散人
Release: 2021-06-03 15:43:50
forward
6416 people have browsed it

The following tutorial column will introduce you to centos installation git from centos. I hope it will be helpful to friends who need it!

Detailed explanation of how to install git on centos

View the git version of the default yum source

# 安装
yum install -y git

# 查看版本
git version

# git version 1.8.3.1
Copy after login

Please refer to the official website, there are two ways to install the new version on CentOS

One , Compile method installation

1. Download the latest version source code
mirrors.edge.kernel.org/pub/softwa...

yum install -y wget

wget -O /tmp/git-2.21.0.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.21.0.tar.gz
Copy after login

2. Unzip and compile

# 安装编译依赖
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

# 解压
tar -zxf /tmp/git-2.21.0.tar.gz -C /tmp/cd /tmp/git-2.21.0# 检验相关依赖,设置安装路径./configure --prefix=/usr/local/git

# 编译安装
make && make install
Copy after login

3. Configure global environment variables

# 删除已有的 git
yum remove git

# 配置环境变量
vim /etc/profile

# 将下面这段话写入到文件最下面
# GIT_HOMEGIT_HOME=/usr/local/gitexport PATH=$PATH:$GIT_HOME/bin

# 刷新
source /etc/profile

# 查看git版本[root@iZm5e2yjivclstt1ylroeuZ git-2.9.5]# git --version
git version 2.9.5
Copy after login

The above is the detailed content of Detailed explanation of how to install git on centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template