How to Deploy a Website from GitHub to cPanel

Deploying from GitHub to your dotCanada hosting account keeps your workflow clean and your site up to date with your latest code. Here's how to get it working using cPanel's Git Version Control.

Prerequisites

  • A GitHub repository containing your website files
  • SSH access or cPanel Terminal access on your dotCanada account
  • A deploy key added to both your server and GitHub (see our guide on connecting GitHub to cPanel)

Clone Your Repository

  1. In cPanel, open Git Version Control.
  2. Click Create, enable Clone a Repository, and enter your GitHub SSH URL.
  3. Set the repository path to a location outside your public web root (e.g., /home/username/repo).
  4. Click Create to complete the clone.

Deploying to the Public Directory

If your project's files belong directly in public_html, you can set your repository path to /home/username/public_html. For frameworks like Laravel, set the path above public_html and configure the document root separately.

Using a Deployment Script

cPanel supports a .cpanel.yml deployment script in your repository. When you pull, cPanel runs this script automatically. Example:

---
deployment:
tasks:
- export DEPLOYPATH=/home/username/public_html/
- /bin/cp -R * $DEPLOYPATH

Pulling Updates

In the Git Version Control panel, click Manage on your repository and then Pull or Deploy to deploy the latest GitHub changes to your server.

Need help setting up your deployment pipeline? Contact our support team - we're happy to assist.

100% Satisfaction Guarantee

We're so confident you'll love dotCanada that we offer a 30-day money-back guarantee. Not satisfied? Get a full refund, no questions asked.

Ready to Get Started?

Join thousands of Canadian website owners who trust dotCanada for reliable, fast web hosting.

Get Started Today