How to Deploy a Website from GitHub Using cPanel Git Version Control Print

  • github, git, cpanel, deployment
  • 0

cPanel Git™ Version Control lets you deploy a site from a GitHub repository to your hosting account. Use it for static sites or applications that do not require a custom build pipeline beyond your repo contents.

Requirements

  • cPanel access with Git Version Control enabled.
  • A repository with your site files.
  • For private repos: SSH key access configured in GitHub.

Public repositories

  1. Open Git™ Version Control in cPanel.
  2. Click Create.
  3. Enter the clone URL, for example https://github.com/username/repo.git.
  4. Set the repository path outside public_html when possible, then deploy copies to the web root.

Private repositories

  1. Generate an SSH key pair in Git Version Control or cPanel SSH Access.
  2. Add the public key to GitHub → Settings → SSH and GPG keys.
  3. Verify host-key fingerprint on first connect.
  4. Clone with the SSH URL [email protected]:username/repo.git.

SSH availability may require approval — SSH access policy.

Deployment destination

  • Point the site document root to the deployed branch contents.
  • Keep the .git directory non-public — do not place the raw repository inside a publicly browsable path unless access is blocked.

Pull updates and .cpanel.yml

  1. Use Update from Remote or Pull after commits land on GitHub.
  2. Optional: add .cpanel.yml in the repo root to copy files to public_html after each pull per cPanel documentation.

Secrets and .env files

Never commit API keys or database passwords. Store .env only on the server outside the repository and add .env to .gitignore.

Dirty working tree and rollbacks

  • Local edits on the server can block pulls — commit or stash server changes intentionally.
  • Roll back by checking out an earlier commit in Git Version Control or redeploying a known good release.

Shared hosting limits

Long-running build tools (Node compile, heavy CI) may exceed shared hosting limits. Build locally or in CI, then deploy built files only.

If Git Version Control is missing from cPanel or deploy hooks fail, submit a ticket with your domain and repository type (public or private).


Was this answer helpful?

« Back

Powered by WHMCompleteSolution