This article describes fetching website files from GitHub into a cPanel-managed repository and deploying them through cPanel’s controls.

Prepare the deployment

Back up the destination and test outside the live site’s document root first. Obtain repository access, including the required SSH authentication for a private repository. Keep the repository itself outside the public document root.

Commit a .cpanel.yml file at the repository root. For a simple repository containing index.html and style.css, an example is:

---
deployment:
  tasks:
    - export DEPLOYPATH=/home/exampleuser/public_html/
    - /bin/cp index.html "$DEPLOYPATH"
    - /bin/cp style.css "$DEPLOYPATH"

Replace the username, destination and file list. Copy only required public website files, not editor configuration, credentials or the whole repository indiscriminately. These tasks can overwrite destination files.

Clone and deploy manually

  1. Open Files > Git Version Control and select Create.

    files

  2. Enter the GitHub clone URL, repository path and name, then create the repository.

    repository

  3. Select Manage > Pull or Deploy.

  4. Select Update from Remote, check the intended revision, then select Deploy HEAD Commit.

    pull or display

The checked-in deployment file, a branch and a clean working tree are required. Check the result and website after deployment. Repeat the update and deploy controls for future GitHub changes; they are not automatic.