cPanel .git Symlink – How to

Since WHM/cPanel 11.36+ Git comes bundled as an additional feature. Whilst this is a great feature to have on a shared hosting platform, it doesn’t come without it’s issues. The main issue is the fact that you can’t natively call

git init

But instead have to call

/usr/local/cpanel/3rdparty/bin/git init

When you’re making multiple updates and need to push to your git repository, this can become a headache…. There is a way around it though, read on!

Whilst in an SSH session, simply type:

nano ./bashrc

A GNU Nano text editor will appear, simply append its contents with the following

PATH=$PATH:/usr/local/cpanel/3rdparty/bin 
export PATH 

So the end result will be

# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
PATH=$PATH:/usr/local/cpanel/3rdparty/bin
export PATH

Once you’ve done that, press Ctrl + X then Y and then Enter to save the changes.
In order for the changes to be accepted you will need to restart the SSH session by logging out and then back in.