Hosting Question? Find the Solution -

KNOWNHOST KNOWLEDGE BASE

Browse our Guides, Articles, and How-To's

Installing Git On A DirectAdmin CentOS Server

Category: DirectAdmin
Tags: # # # #
Due to CentOS maintaing and providing the RPM’s for its service, 1.8 is the default version if installed by the OS.

Git is available via yum and can be installed with the following command,

yum install git -y

You can now confirm git is installed using the following command,

git --version

Expected result should look like this,

[root@duplicate]# git --version
git version 1.8.3.1

You could quickly get up and running with Git via Yum, as demonstrated above. For most users, this is perfectly fine, but if there is some feature that you need that is only present in the later versions, you will need to install it from the source to have that feature.


Git (Source Install)

Version 2.28 requires asciidoc and xmlto packages and may require a 3rd party repo to install.

We recommend using 2.26 for now with CentOS 7 unless you’re savvy with repo additions.

To install from source, go ahead and log into your server via SSH as the root user.

First, we’ll need to grab the latest available version,

github.com/git/git/archive/v2.26.0.tar.gz

For other releases use: github.com/git/git/releases

Left-click on the tar.gz link for that version and ‘Copy Link Location‘. Now, back in the terminal, run the following commands (but change the wget url/version accordingly for the version you are installing),

yum install gettext-devel -y
cd /usr/local/bin/
wget https://github.com/git/git/archive/v2.26.0.tar.gz
tar -zxf v2.26.0.tar.gz
cd git-*
make configure
./configure --prefix=/usr
make all doc info
make install install-doc install-html install-info

Now confirm the version of git installed,

[root@duplicate git-2.26.0]# git --version
git version 2.26.0

You have successfully installed Git on CentOS server.

Note that you can use Git itself from now onward to update Git, like so,

cd /usr/local/bin/
git clone https://github.com/git/git.git
[root@duplicate bin]# git clone https://github.com/git/git.git
Cloning into 'git'...
remote: Enumerating objects: 271307, done.
remote: Total 271307 (delta 0), reused 0 (delta 0), pack-reused 271307
Receiving objects: 100% (271307/271307), 120.29 MiB | 12.03 MiB/s, done.
Resolving deltas: 100% (201377/201377), done.
[root@duplicate bin]# 
[root@duplicate bin]# git --version
git version 2.26.0

Conclusion

Now that we’ve gone over installing Git on a DirectAdmin CentOS server. We have covered both the methods for installing Git as well as elaborating steps for updating Git from the existing Git itself.

KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you with requests should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your webhosting experience.