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


  1. Log in at https://tpc-hosting.com/login and open cPanel.
  2. Under Files , click Git Version Control.




  • * *


Create a new repository


  1. Click Create.
  2. Choose whether to clone an existing remote repository or create a bare repository on the server.
  3. 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.
  4. Set the repository name for display in cPanel.
  5. 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.
  6. 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:


  1. Add a .cpanel.yml file to your repository root with the deployment commands.
  2. Push to the server repository.
  3. In cPanel → Git Version Control, find your repository and click Manage.
  4. Click Deploy HEAD Commit to trigger the deployment manually, or enable automatic deployment on push.




  • * *


Push to the server from your local machine


  1. In cPanel → Git Version Control, click Manage on your repository.
  2. Copy the Clone URL (SSH format).
  3. On your local machine, add the server as a remote:

git remote add production ssh://yourusername@yourserver/home/yourusername/repos/myproject


  1. Push to the server:

git push production main


  1. 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

Was this article helpful?

Share your feedback

Cancel

Thank you!