Git version control system plays a major role in the development of modern software. Version control is a set of tools that allow developers to work in a team, jointly controlling the process of development and the version history of the software.
Git will not overwrite changes made by other developers allowing you to track every change made to the source code thereby returning the original state of the file or project. In this article we will look at how to install git CentOS 8.
Installing Git in CentOS 8
Tools versioning tools make it easy to restore files if they were lost in the process of developing the program, and in the case of errors allow you to compare current and earlier versions of the file ipreview the error or conflict development.
Git is the most popular tool used for version control developed in 2005 by the Creator of the Linux kernel by Linus Thorvald.
Git provides such functions as data security, workflows, creation of branches, return to the previous stage, incredible speed, tracking code changes, view logs, and more. This allows developers working in offline mode, providing as necessary an Internet connection to publish the latest project changes.
We will tell you how to install git on Centos 8 using the yum package Manager and to compile and install from source. Each of the following methods has its advantages and disadvantages. The choice of installation method is up to you, as if you wanted it easy to update your version control system, your choice will stop on a package Manager is yum, and if you require any of the features that exist in a particular version, then your choice is compiling from source.
Attention!!! To complete installation you must have installed and configured the server with operating system Centos 8, and created a user with sudo rights granted him by the root. Otherwise, the installation will be impossible!
Install git using Yum
One of the most popular and simplest methods of installing the version control system git is installing it using the package Manager yum. However, the version contained in the repository centos might be outdated, since the newest version, available in the project repositories on github do not always quickly added to repositories centos. If you want to install the latest available on github git version – we recommend you to consider the possibility of its Assembly and installation from source code hosted in the repository project on github. Manual explaining how to compile and install git from source given at the end of our guide.
First go into sudo user by entering the following command:
The system will ask you to enter a password. Enter the password from the previously created sudo user. Then enter the command:
yum install git
After installing git, you can check the version of the installed system with the command:
At the time of this writing, the latest version available in the repositories of CentOS is version 2.18.1
Build Git from source
If you have any need to use any specific version of git, or you need flexibility in the installation of the version control system, then your choice is to install from source. This method does not allow to manage the installation of the version control system and you upgrade this installation using the yum package Manager is not possible, however it will allow you to install the latest version of the system currently available in the project repositories on github. This method is somewhat complicated and lengthy process.
First we need to install the utilities required to compile the source code into an executable file. This is done by running the following command:
yum install unzip wget gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel libcurl-devel expat-devel
After successful installation of all necessary utilities, open a browser and navigate to the project page on github. The top of the page you will find a link to the latest version of git. Then, in the list of versions, select the version you need, click the right mouse button and copy the link to download the source tarball (*.tar.gz) then use the following wget command:
wget https://github.com/git/git/archive/v2.23.0.tar.gz -O git.tar.gz
When the download is complete rotaryforum source code using the tar command and change to the folder with the source code.
Now assemble and install git from the source code using the command:
make prefix=/usr/local all install
At the end of the Assembly and installation you can check the version of the installed git with the command:
Install git centos 8 is finished, now let’s talk a little bit about the setting.
Now, when your server is successfully installed, the version control system, you need to configure personal information, which will be used by developers when making changes in the code being developed. This operation is performed with the following commands:
git config --global user.name "Your name"
git config --global user.email "[email protected]"
After you run these commands you must make sure that the parameters mentioned above were added. You can check the validity of the entered commands by running the following command:
git config --list
The output of this command will list you all the settings made during configuration of personal information.
Settings made by us will be stored in the configuration file *.gitconfig. To make changes to this file, you can run git config, or by editing this file manually with your favorite text editor.
That’s all. In this article we tell you how to install git on CentOS using the yum package Manager, or compile and install from source. Armed with the skills learned you can easily repeat all steps to reproduce the installation of the version control system on your server. Thank you for your attention.