How to install Git 2.18 on CentOS

Git is an open-source distributed version control system. In this tutorial, I will install Git 2.18 client on Centos.

CentOS’s default package repositories might not always have the latest version of Git available.

Here’s how you can install Git 2.18 on CentOS:

Jenkins release the source error code as below:

/remotes/origin/*" returned status code 128: error: The requested URL returned error: 401 while accessing https://github.com/xxx/xxx/info/refs
fatal: HTTP request failed

Solve problem Required Git >= 1.7.10

Step 1: Install the required packages

Before installing git makes sure you have installed in the package your system.

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker

Step 2: Install git on Centos

Downloading Git source code from kernel git

cd /usr/src
wget https://www.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
tar xvzf git-2.18.0.tar.gz

After extracting the git source code and compiling the source code as below:

cd git-2.18.0
make prefix=/usr/local/git all
make prefix=/usr/local/git install

Step 3: Setup Environment

After the installation completes, you might need to update your system’s PATH environment variable to include the Git binary directory. Add the following line to your shell configuration file (e.g., .bashrc, .bash_profile, or .profile):

Set the PATH variable and reload the change in the current environment

echo "export PATH=/usr/local/git/bin:$PATH" >> /etc/bashrc

To apply the updated PATH configuration, either restart your shell session or run the following command:

install git

After completing the steps. Verify that Git has been installed correctly by running:

git --version

Conclusion

Through the article, you should be able to manually build and install Git version 2.18.0 on CentOS. However, it’s worth noting that using the package manager or a more recent pre-built version from official repositories is generally recommended for easier maintenance and updates. I hope will this your helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

1 thought on “How to install Git 2.18 on CentOS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.