How to install Git on CentOS 8

Git is a distributed version control system used by most software teams today. It allows you to track your code changes, restore the previous staging area, create branches, and collaborate with your development colleagues.

Git was originally developed by Linus Torvalds, the creator of the Linux kernel.

This guide explains how to install Git on CentOS 8.

The easiest and most recommended way to install Git is to use the yum package manager to install it.

If you want to compile and install the latest stable Git from the source code, slide to the back to see " Installing Git from the Source " in the guide

1. Install Git via yum

The Git package is included in the default source repository of CentOS.

As root or another user with sudo privileges, install Git on your CentOS system:

sudo yum install git

Print out the Git version number by typing the following command:

git --version

At the time of writing this article, the currently available version of Git in the CentOS 8 source repository is 2.18.1.

git version 2.18.1

that's it. You have installed Git and are ready to use it.

Second, install Git through source code

Compiling Git from source code allows you to install the latest Git version and customize some build options. In any case, you will not be able to maintain your Git installation process through the yum package manager.

Start to install some necessary dependency packages to build Git on CentOS:

sudo yum groupinstall "Development Tools"
sudo yum install curl-devel expat-devel gettext-devel openssl-devel  perl-CPAN perl-devel zlib-devel

Once the installation is complete, open your browser, browse: Git project's mirror on GitHub, and copy the latest release link, ending with .tar.gz.

Currently, the latest stable version of Git is 2.23.0.

We download the Git source code to the /usr/src directory, usually we put the code here. Switch to this directory:

cd /usr/src/

Use the previously copied link to download the tar.gz file just now, similar to git.tar.gz

sudo wget https://github.com/git/git/archive/v2.23.0.tar.gz -O git.tar.gz

Next, unzip and enter the following command to switch to the git source code directory:

sudo tar -xf git.tar.gz
cd git-*

Run the following two commands to compile and install Git on your CentOS system

sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

Enter git --version to verify your installation:

git --version
git version 2.23.0

Later, if you want to upgrade to a newer version, download the compressed package and repeat the same build process.

Three, configure Git

Now that you have installed Git on your CentOS machine, it is time to set your personal information. The following command will set your submission name and email address:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

To confirm that your information is correct, enter:

git config --list
user.name=Your Name
[email protected]

This configuration information is stored in the ~/.gitconfig file:

[ user]
 name = Your Name
 email = [email protected]

If you want to add some global Git configuration information, you can use the git config command or directly edit the ~/.gitconfig file.

Four, summary##

Installing Git on CentOS 8 is very simple, just a single yum command can do it. If you want to use the latest version of Git, you need to compile it from source.

If you are new to Git, I suggest you read "Pro Git Chinese Version", it is an excellent book on learning how to use Git.

Recommended Posts

How to install Git on CentOS 8
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TensorFlow on CentOS 8
How to install Git on Ubuntu 20.04
How to install TeamViewer on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install Git on Ubuntu 20.04
How to install GCC on CentOS 8
How to install Yarn on CentOS 8
How to install Nginx on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Vagrant on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to install OpenCV on CentOS 8
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install Apache Maven on CentOS 8
How to install Apache Kafka on CentOS 7
[Graphic] How to install tomcat on centos
R&D: How To Install Python 3 on CentOS 7
How to install GCC compiler on CentOS 7
How to install offline JDK1.8 on centos7.0
How to install and configure Elasticsearch on CentOS 7
How to install Visual Studio Code on CentOS 8
How to install and use Docker on CentOS 7
How to install RPM packages on CentOS Linux
How to install and configure VNC on CentOS 8
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install and configure phpMyAdmin on CentOS 6
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8
How to install VirtualBox client extension on CentOS 8
How to install Git on Ubuntu 18.04 [Quick Start]
How to install Docker CE on RHEL 8 / CentOS 8