Skip to content
Deploying apps4 min read

Git deployment in cPanel with .cpanel.yml

Short answer

In cPanel open Files › Git Version Control, clone your repository into a folder outside public_html, and commit a `.cpanel.yml` at the repository root that lists shell tasks such as `export DEPLOYPATH=/home/USER/public_html/` and `/bin/cp`. Then, under Manage › Pull or Deploy, click Update from Remote and Deploy HEAD Commit.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Prerequisites
  2. Step by step
  3. Troubleshooting
  4. On ArabyHost

cPanel’s Git Version Control keeps a copy of your repository in your account, and a small YAML file, .cpanel.yml, tells cPanel what to do with it on each deploy. The tasks are ordinary shell commands. Most failures come from YAML formatting, wrong paths, or a working tree that has local changes.

Prerequisites

  • A Git repository (GitHub, GitLab or similar). Public repositories can be cloned over HTTPS; private ones need an SSH deploy key.
  • Your cPanel username, which appears in every absolute path (/home/USER/...).
  • For private repositories and push deployment: SSH access, which on ArabyHost comes with the AI/Developer plans.

Step by step

1. Write .cpanel.yml

The file must be named exactly .cpanel.yml, sit at the top level of the repository, use spaces (never tabs), and be committed. A static site:

---
deployment:
  tasks:
    - export DEPLOYPATH=/home/USER/public_html/
    - /bin/cp index.html $DEPLOYPATH
    - /bin/cp -R css $DEPLOYPATH
    - /bin/cp -R js $DEPLOYPATH
    - /bin/cp -R images $DEPLOYPATH

Listing folders explicitly is safer than cp *, which skips dotfiles such as .htaccess and can copy things you didn’t mean to publish. To copy the whole repository except private files, rsync is cleaner:

---
deployment:
  tasks:
    - export DEPLOYPATH=/home/USER/public_html/
    - /bin/rsync -a --exclude='.git' --exclude='.cpanel.yml' --exclude='.env' ./ $DEPLOYPATH

A PHP app with Composer (AI/Developer plans), deployed to a folder whose public/ is the document root:

---
deployment:
  tasks:
    - export DEPLOYPATH=/home/USER/app/
    - /bin/rsync -a --delete --exclude='.git' --exclude='.env' --exclude='storage/' ./ $DEPLOYPATH
    - cd $DEPLOYPATH && /usr/local/bin/composer install --no-dev --optimize-autoloader --no-interaction

Check the Composer path with which composer over SSH. The tasks run in order in one shell, which is why DEPLOYPATH set in the first line is still available in the next ones.

2. Create the repository in cPanel

Open Files › Git Version Control and click Create:

  • Clone a Repository: on.
  • Clone URL: https://github.com/you/site.git for a public repository, or [email protected]:you/site.git for a private one over SSH.
  • Repository Path: /home/USER/repositories/site. Never public_html, or the .git folder becomes downloadable.
  • Repository Name: any label, such as site.

Click Create. cPanel clones the default branch.

3. Private repositories: add a deploy key

Over SSH, create a key without a passphrase, trust GitHub’s host key, and test the connection:

ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" -C "cpanel-deploy"
cat ~/.ssh/id_ed25519.pub
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh -T [email protected]

Paste the public key in GitHub under the repository’s Settings › Deploy keys › Add deploy key, leaving write access off. ssh -T should answer You've successfully authenticated, but GitHub does not provide shell access. Then create the repository in cPanel with the [email protected]: URL.

4. Pull and deploy

Click Manage next to the repository and open the Pull or Deploy tab:

  1. Update from Remote fetches and merges the latest commits of the checked-out branch.
  2. Deploy HEAD Commit runs the tasks in .cpanel.yml.

The same tab shows the last deployed commit. To deploy a different branch, change Checked-Out Branch in the Basic Information tab.

5. Optional: push deployment

On AI/Developer plans you can push to the cPanel repository directly; cPanel then deploys on its own after each push. The Basic Information tab shows the clone URL to add as a remote, for example ssh://USER@HOST:PORT/home/USER/repositories/site. The GitHub deploy guide compares this with GitHub Actions.

6. Read the deploy log

Each deployment writes a log in ~/.cpanel/logs/, with a name like vc_1732612345.123456_git_deploy.log. It shows every task and its output, so it’s the first place to look when files didn’t change.

Troubleshooting

  • Deploy HEAD Commit is greyed out: .cpanel.yml is missing from the top level, isn’t committed, or the server’s copy has uncommitted changes. Over SSH run git status in the repository; discard edits with git checkout -- . or commit them.
  • The deploy reports success but nothing changed: you deployed before pulling. Click Update from Remote first.
  • YAML errors: tabs instead of spaces, a missing --- line, or a dash without a space after it.
  • cp: omitting directory: add -R for folders.
  • Files land in the wrong place: DEPLOYPATH must be absolute, end with / and use your real username.
  • Cloning fails with Host key verification failed or Permission denied (publickey): finish step 3. See host key verification failed.
  • A push to the cPanel repository is rejected: your local branch is behind. See git push rejected.

On ArabyHost

cPanel’s Git Version Control is available in your account, opened with one click from the Araby Panel, and the panel’s own Git tab offers a simpler path for public HTTPS repositories: one Deploy click pulls and runs your tasks (see Deploy from GitHub). The AI/Developer plans add SSH jailed in CageFS for private repositories, push deployment and Composer. Claude or Cursor can also run a deploy through Araby MCP, and JetBackup’s daily backups give you a second way back besides Git. For a PHP site with a database, continue with uploading a PHP site.

FAQ

Where should the repository live on the server?

Outside public_html, for example /home/USER/repositories/site. The .cpanel.yml tasks copy only the files the site needs into public_html, so the .git folder and private files never become reachable from the web.

Can .cpanel.yml run npm or composer?

The tasks are shell commands that run as your cPanel user, so on AI/Developer plans you can call composer or npm with full paths. Heavy builds may hit your account's resource limits, so building in GitHub Actions is often the better choice.

Does a new commit on GitHub deploy itself?

No. A cloned repository is updated only when you click Update from Remote, and files are copied only when you click Deploy HEAD Commit. Pushing straight to the cPanel repository over SSH is the exception: that push deploys automatically.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.