Deploying GitHub Repositories with cPanel Git™ Version Control
What is cPanel Git™ Version Control?
cPanel provides a native graphical interface to clone, track, and deploy code from Git repositories (GitHub, GitLab, Bitbucket) directly into your hosting directory.
Configuring SSH Deploy Keys for Private Repositories
- In cPanel, open SSH Access > Manage SSH Keys > Generate a New Key.
- View and copy the generated Public Key.
- In GitHub, go to your repository: Settings > Deploy Keys > Add Deploy Key and paste the key.
Cloning the Repository
- Open Git™ Version Control in cPanel and click Create.
- Provide the Git SSH clone URL and specify your destination path.
- Click Create to complete the initial clone.
Automating Deployment with .cpanel.yml
Include a .cpanel.yml file in your repo root to copy files to public_html upon pulling changes:
---
deployment:
tasks:
- export DEPLOYPATH=/home/username/public_html/
- /bin/cp -R * $DEPLOYPATH
Was this helpful?
Thanks for your feedback!