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

Related Articles

How to Restore Your cPanel Account: A Complete Guide for New System Administrators

This guide explains how new system administrators can restore a cPanel account using WHM, transfer accounts and configurations between servers, and enable diagnostic logging for transfer and restore operations. It covers essential concepts such as WHM vs. cPanel, root access, backup handling, SFTP uploads, transfer methods, and advanced debugging tools.

Continue

آموزش کامل انتقال تمام اکانت‌های cPanel از یک سرور به سرور دیگر

این مقاله نحوه انتقال همه اکانت‌های cPanel، تنظیمات سرویس‌ها، گواهی‌های SSL و IP اصلی سرور را از یک سرور قدیمی (Source) به یک سرور جدید (Target) توضیح می‌دهد. شامل نصب سرور جدید، انتقال تنظیمات، انتقال اکانت‌ها، تغییر IP، تنظیم DNS و نصب مجدد SSL است.

Continue

How to Migrate a WordPress® Installation to a cPanel & WHM Server

This guide explains how to migrate a WordPress installation from a macOS-hosted environment to a cPanel & WHM server. It covers exporting the database, uploading WordPress files, creating and importing a MySQL database, updating URLs, configuring wp-config.php, fixing broken links, and finalizing the migration.

Continue

How to Manually Transfer an Account Between Servers in cPanel & WHM

This article explains how to manually transfer a cPanel account between servers when the account is too large for WHM’s automated transfer tools. It covers creating temporary directories, compressing public_html and log files, securely transferring data with SCP, and restoring the files on the destination server.

Continue

How to Manually Migrate Horde Calendars and Contacts to Roundcube in cPanel & WHM

This article explains how to manually migrate Horde calendars and contacts to Roundcube in cPanel & WHM version 108 through 118. It covers exporting Horde data, placing it in the correct directories, and importing it into Roundcube using built‑in plugins or manual import tools.

Continue

How to Manually Migrate Accounts to cPanel & WHM from Unsupported Control Panels

This article explains how experienced system administrators can manually migrate accounts from unsupported third‑party control panels to cPanel & WHM. It covers pre‑migration steps, installation requirements, file and directory transfers, database restoration, SSL migration, and post‑migration tasks.

Continue