Guide to Git Deployment

This article explains how deployment works for Git repositories managed through cPanel’s Git Version Control feature. It covers deployment requirements, the structure and purpose of the .cpanel.yml file, examples for deploying files and directories, and the differences between automatic (push) and manual (pull) deployment workflows.

Git DeploymentcPanel Git.cpanel.yml

~3 min read • Updated Feb 21, 2026

1. Overview


The Git™ Version Control feature in cPanel allows you to deploy your cPanel-managed repositories. Deployment typically sends finished code into production. You can configure deployment to run automatically (push deployment) or manually (pull deployment).


For example, you can make changes to your website locally and automatically deploy them to a directory on your cPanel account.


For more information:


  • Git™ Version Control documentation
  • Advanced Configuration and Troubleshooting documentation
  • Common Git Commands documentation

2. Requirements


Before deployment, repositories must meet the following requirements:


  • A valid .cpanel.yml file checked in at the top-level directory
  • One or more local or remote branches
  • A clean working tree

If these requirements are not met, deployment information will not appear and deployment functionality will be disabled.


3. The Deployment YAML File (.cpanel.yml)


The .cpanel.yml file determines how and where changed files deploy. Each cPanel-managed repository must include this file in its top-level directory.


Important:

  • The examples below must be customized for your needs.
  • Do not use wildcard characters (e.g., *) to deploy all files — this may deploy the .git directory.
  • Do not use invalid YAML characters.

3.1 Deploy Individual Files


---
deployment:
  tasks:
    - export DEPLOYPATH=/home/example/public_html/
    - /bin/cp index.html $DEPLOYPATH
    - /bin/cp style.css $DEPLOYPATH

Explanation:

  • Line 1: Start of YAML file
  • Lines 2–3: Define deployment and tasks
  • Lines 4–6: Array of BASH commands executed during deployment

3.2 Deploy an Entire Directory


---
deployment:
  tasks:
    - export DEPLOYPATH=/home/example/public_html/
    - /bin/cp -R images $DEPLOYPATH

Explanation is similar to the previous example.


4. Automatic (Push) Deployment


Important: cPanel automatically adds a post-receive hook to all cPanel-managed repositories.


When you push changes to a repository that contains a .cpanel.yml file, the hook automatically deploys those changes.


With push deployment:

  • You pull changes from a remote repository to your local machine
  • You push changes to the cPanel-managed repository
  • The system automatically runs the commands in .cpanel.yml

Note: You can manually redeploy without new changes if needed.


5. Manual (Pull) Deployment


With pull deployment:

  • You push changes from your local machine to a remote repository
  • In cPanel, click Update from Remote to pull changes into the cPanel-managed repository
  • Click Deploy HEAD Commit to run the deployment commands

This deployment type does not run automatically. You must repeat the steps each time.


Conclusion


By using the .cpanel.yml file and choosing between push or pull deployment, you can control how your Git-based projects deploy in cPanel. Push deployment provides full automation, while pull deployment offers manual control through the cPanel interface.


Written & researched by Dr. Shahin Siami