How to Use Git Version Control in cPanel
cPanel includes a Git Version Control tool that lets you create Git repositories on your hosting account, clone remote repositories, and deploy code automatically when you push to the server.
- * *
Open Git Version Control
- Log in at https://tpc-hosting.com/login and open cPanel.
- Under Files , click Git Version Control.
- * *
Create a new repository
- Click Create.
- Choose whether to clone an existing remote repository or create a bare repository on the server.
- Set the repository path — the directory on your server where the repository will live (e.g., /home/yourusername/repos/myproject). Do not put it inside public_html if the repository contains private code.
- Set the repository name for display in cPanel.
- If cloning a remote: paste the clone URL (HTTPS or SSH). For private repositories, add your SSH key to the remote service (GitHub, GitLab, Bitbucket) first.
- Click Create.
- * *
Deploy code from a remote repository
cPanel Git Version Control supports automatic deployment via a .cpanel.yml deployment file in your repository root. When you push to the server, cPanel runs the commands in that file.
Example .cpanel.yml for a PHP site:
deployment:
tasks:
- export DEPLOYPATH=/home/yourusername/public_html/
- /bin/cp -rf . $DEPLOYPATH
Steps:
- Add a .cpanel.yml file to your repository root with the deployment commands.
- Push to the server repository.
- In cPanel → Git Version Control, find your repository and click Manage.
- Click Deploy HEAD Commit to trigger the deployment manually, or enable automatic deployment on push.
- * *
Push to the server from your local machine
- In cPanel → Git Version Control, click Manage on your repository.
- Copy the Clone URL (SSH format).
- On your local machine, add the server as a remote:
git remote add production ssh://yourusername@yourserver/home/yourusername/repos/myproject
- Push to the server:
git push production main
- If you have a .cpanel.yml, the deployment runs automatically after the push.
You will need SSH access set up to push via SSH. See: How to Connect to Your Hosting Account via SSH.
- * *
Common use cases
- Deploy a static website or HTML project directly from your code editor
- Keep a staging and production branch and deploy each to a different domain
- Pull the latest version of a project from GitHub without FTP
- Maintain version history for your codebase on the server
Updated on: 28/04/2026
Thank you!