WebGee DocsDocs
Development
Free migration + 30-day money-backSee how

Use Git over SSH

Git is installed on WebGee servers but is not on your PATH. The full path to use, and how to make it permanent.

Use Git on your hosting account over SSH. Applies to shared and reseller hosting with SSH enabled.

Git is installed, but it is not on your PATH, so git alone returns command not found. That is the whole difficulty.

The full path

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

For example:

/usr/local/cpanel/3rdparty/bin/git clone https://github.com/example/repo.git
/usr/local/cpanel/3rdparty/bin/git status

Make it permanent

Typing that every time is unbearable. Add an alias to ~/.bashrc:

echo 'alias git="/usr/local/cpanel/3rdparty/bin/git"' >> ~/.bashrc
source ~/.bashrc

Or put the directory on your PATH, which also fixes tooling that shells out to git itself:

echo 'export PATH="/usr/local/cpanel/3rdparty/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Prefer the second if you use anything that invokes Git indirectly — Composer, for instance.

Deploying from a repository

A common pattern is cloning into your document root and pulling to deploy:

cd ~/public_html
/usr/local/cpanel/3rdparty/bin/git clone https://github.com/example/site.git .

Cloning into public_html puts .git inside your web root, and on many configurations it is downloadable. That exposes your entire history — including any credentials ever committed, even if later removed.

Either block it in .htaccess:

RedirectMatch 404 /\.git

or clone outside the web root and deploy from there, which is safer.

Authenticating to a private repository

Use a deploy key or a personal access token, not your account password.

For a deploy key, generate one on the server and add the public half to the repository as read-only — see Connect over SSH for key generation.

Never put a token in a remote URL that gets committed. git remote -v shows it, and it ends up in your shell history.

cPanel's Git Version Control

cPanel also has a Git Version Control interface under Files, which handles clone and pull without SSH. Easier for simple deployments; the command line is better for anything involving branches.

On this page

Hosted elsewhere?

Cloud Hosting

cPanel on NVMe storage, with LiteSpeed, free SSL and daily backups included.

See plansFree migration