Contents
“Deploy from GitHub” can mean three different setups, from one click per release to a fully automatic pipeline that runs on every push. They all start from the same rule: the server gets your code from Git, never from manual edits in File Manager, so what runs in production is always a commit you can see.
Which method fits
| Method | Deploys on every push? | Needs SSH | Good for |
|---|---|---|---|
| 1. Git Version Control + Deploy | No, one click | No (public repo over HTTPS) | PHP and static sites |
| 2. Push to the repository on the server | Yes | Yes | Developers pushing from their machine |
| 3. GitHub Actions over SSH | Yes | Yes | Sites with a build step (React, Vite, Next.js) |
Prerequisites
- A GitHub repository with your site.
- For methods 1 and 2, a
.cpanel.ymlfile at the repository root. The cPanel Git guide explains its syntax in detail. - For methods 2 and 3, SSH access: on ArabyHost, an AI/Developer plan.
Method 1: Git Version Control with a Deploy button
- Commit a
.cpanel.ymlsuch as:
---
deployment:
tasks:
- export DEPLOYPATH=/home/USER/public_html/
- /bin/cp -R public/. $DEPLOYPATH
- In cPanel open Files › Git Version Control › Create, keep Clone a Repository on, and paste
https://github.com/you/site.gitas the Clone URL. Use a Repository Path outsidepublic_html, such as/home/USER/repositories/site. - After each push to GitHub, open Manage › Pull or Deploy, click Update from Remote, then Deploy HEAD Commit.
The Araby Panel does the same from its Git tab: enter the HTTPS URL of a public repository and click Deploy, which pulls and runs the tasks in one step. See Deploy from GitHub.
Method 2: push straight to the server (automatic)
The repository that cPanel manages can receive pushes. When it does, cPanel runs .cpanel.yml by itself. The Basic Information tab shows its clone URL; add it as a second remote on your computer:
git remote add hosting ssh://USER@HOST:PORT/home/USER/repositories/site
git push hosting main
Your SSH key must be authorized in the account first; see setting up SSH keys. Push to GitHub as usual, and push to hosting when you want to release.
Method 3: GitHub Actions on every push
1. Create a deploy key
On your computer:
ssh-keygen -t ed25519 -f gh-deploy -N "" -C "github-actions-deploy"
Add the contents of gh-deploy.pub to ~/.ssh/authorized_keys on the server (in cPanel: Security › SSH Access › Manage SSH Keys › Import Key, then Authorize).
2. Add repository secrets
In GitHub open Settings › Secrets and variables › Actions › New repository secret and add SSH_PRIVATE_KEY (the contents of gh-deploy), SSH_HOST, SSH_USER and SSH_PORT with your account’s SSH details.
3. Add the workflow
Create .github/workflows/deploy.yml:
name: Deploy
on:
push:
branches: [main]
concurrency: deploy
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci && npm run build
- name: Upload over SSH
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_PORT: ${{ secrets.SSH_PORT }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -p "$SSH_PORT" "$SSH_HOST" >> ~/.ssh/known_hosts
rsync -az --exclude='.well-known' \
-e "ssh -i ~/.ssh/deploy_key -p $SSH_PORT" \
dist/ "$SSH_USER@$SSH_HOST:public_html/"
concurrency: deploy stops two deploys from overlapping. For a PHP project without a build step, replace the build and rsync with a pull on the server:
ssh -i ~/.ssh/deploy_key -p "$SSH_PORT" "$SSH_USER@$SSH_HOST" \
'cd ~/site && git pull --ff-only && composer install --no-dev --optimize-autoloader'
Keep .env and uploaded files out of Git. They stay on the server, and rsync without --delete leaves them alone.
Troubleshooting
Permission denied (publickey)in the Actions log: the public key isn’t authorized, or the user or port is wrong. See SSH permission denied (publickey).Host key verification failed: thessh-keyscanline is missing or uses the wrong port.- The Deploy button is greyed out in cPanel:
.cpanel.ymlis missing from the root, or the repository on the server has uncommitted changes. git pullsays local changes would be overwritten: someone edited files on the server. Rungit status, keep what you need in Git, thengit checkout -- ..- Push to the server is rejected: your branch is behind the server’s copy. See git push rejected.
- Files you uploaded by hand disappeared: you used
rsync --deleteon a folder that holds more than the build. Exclude those paths or drop--delete.
On ArabyHost
Every website hosting plan can deploy from GitHub through cPanel’s Git Version Control with .cpanel.yml, or through the Araby Panel’s Git tab. The AI/Developer plans add SSH jailed in CageFS, Git, Composer, Node.js 20 and 24 and Python 3.9-3.12, which is what methods 2 and 3 need. You can also ask Claude or Cursor to deploy through Araby MCP. JetBackup keeps daily backups, so a bad release can be rolled back from a backup as well as from Git. For a build-based app, see deploying a React app.
FAQ
Does cPanel deploy by itself when I push to GitHub?
No. cPanel pulls from GitHub only when you click Update from Remote (or Deploy in the Araby Panel). For a deploy on every push, use GitHub Actions or push directly to the repository on the server.
Can I deploy a private repository?
Yes. GitHub Actions checks out private code itself and only needs SSH access to your account. cPanel's Git Version Control can also clone a private repository over SSH with a deploy key, while the Araby Panel's Git tab accepts public HTTPS repositories for now.
Is it safe to keep an SSH key in GitHub Secrets?
GitHub stores secrets encrypted and hides them in logs. Use a key made only for deploys, never your personal key, and remove it from authorized_keys when you stop using the workflow.