Linux installation git (centos7)-yum

Install Git on a Linux system

Git is a distributed version control system suitable for handling small to very large projects. On Linux systems, we can install Git through the command line.

Step 1: Use the built-in software manager to install

First, you can install git directly with yum in centos, and execute the following command in the terminal:

yum -y install git

Step 2: Check Git

Use the following command to check whether git is installed successfully

git --version

insert image description here

Step 3: Set git environment variables

Find the git directory with the command

find / -name git

insert image description here

As shown in the picture, the git installation directory is in: /usr/libexec/git-core/git

# 需要编辑的文件
vim /etc/profile 
# 需要添加的字段
export PATH=$PATH:/usr/libexec/git-core/git/bin
# 生效环境变量
source /etc/profile

Guess you like

Origin blog.csdn.net/dwh19992018/article/details/130265374