How to install git on cPanel server
Introduction
Git is a free and open source distributed version control system which can handle everything from small to very large projects with speed and efficiency.
This article describes installing git version control system on your server with CentOS 6 operating system and cPanel hosting control panel.
Requirements
Commands described here require root user privilege on the CentOS 6 server.
Installing git
Git package is available on base YUM repository of CentOS 6. So it can be installed using yum package manager tool. git package requires a few Perl module packages. But installing Perl packages using yum is disabled by following cPanel-create exclude setting in /etc/yum.conf:
[main] exclude=bind-chroot courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
As you can see cPanel has created this exclude in the main configuration section of YUM. To install git, you need to temporarily disable this exclude in main section so that Perl packages required by git can be installed. The yum package manager command for disabling this exclude temporarily and installing git is given below:
yum --disableexcludes=main install git
Alternative method to use git in a cPanel server is to use the git tool bundled with cPanel. Since cPanel version 11.36, git is included in cPanel software. Git binary installed by cPanel is located at /usr/local/cpanel/3rdparty/bin/git. You can create a symbolic link to this binary as given below:
ln -s /usr/local/cpanel/3rdparty/bin/git /usr/bin/git
Now git can be accessed with git command:
root@server [~]# git --version git version 2.2.0