Article Directory
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
Step 3: Set git environment variables
Find the git directory with the command
find / -name git
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