Page tree
Skip to end of metadata
Go to start of metadata

Overview

The Git™ Version Control feature (cPanel >> Home >> Files >> Git Version Control) allows you to deploy your cPanel-managed repositories. Generally, deployment sends finished code into production. You can use different configurations to automatically (push deployment) or manually (pull deployment) deploy changes.

  • For example, you could use deployment to make changes to your website locally and then automatically send them to a directory on your cPanel account.
  • For more information about how to deploy changes, read our Git Version Control documentation.
  • For more information about how to troubleshoot problems with this feature, read our Guide to Git - For System Administrators documentation.

Requirements

Before deployment, repositories must meet the following requirements:

  • A valid checked-in .cpanel.yml file in the top-level directory.

  • One or more local or remote branches.

  • A clean working tree.

If a repository does not meet these requirements, the system will not display deployment information and will disable deployment functionality.

The .cpanel.yml file

The .cpanel.yml file determines how and where the changed files deploy. You must check a .cpanel.yml file in to the top-level directory for each cPanel-managed repository that you wish to deploy. .cpanel.yml files must use the format in the example below.

The following .cpanel.yml file deploys the index.html and style.css files to the example account's public_html directory:

---
deployment:
  tasks:
    - export DEPLOYPATH=/home/user/public_html/
    - /bin/cp index.html $DEPLOYPATH
    - /bin/cp style.css $DEPLOYPATH
  • Line 1 signifies the beginning of a YAML file.
  • Line 2 and 3 add the deployment and tasks keys, respectively.
  • Lines 4 through 6 specify an array of BASH commands to run during deployment. You can add as many commands to this array as you wish.

Note:

To add comments to this file, add a line that begins with the hash character (#).

Automatic or push deployment

Important:

cPanel's Git Version Control feature (cPanel >> Home >> Files >> Git Version Control) automatically adds a post-receive hook to all cPanel-managed repositories.

  • When you push changes directly to a cPanel-managed repository that includes a .cpanel.yml file, the hook deploys those changes automatically.
  • For more information, read Git's githooks documentation.


Automatic push deployment of a website.

With push deployment, a single git push command sends changes from your local computer to your cPanel-managed repository. The system then automatically runs the commands in your .cpanel.yml file to send changes from the cPanel-managed repository to a production directory. (For example, to the directory that contains your website's public files.)

Note:

You can use manual deployment to deploy your repository again without new changes.

Manual or pull deployment

Manual pull deployment of a website with a remote repository.

With pull deployment, the git push command sends changes from your local computer to a remote repository. When you click Update from Remote in the Pull or Deploy tab of the Manage section of the Git Version Control interface (cPanel >> Home >> Files >> Git Version Control), the system retrieves changes from the remote repository and applies them to the cPanel-managed repository. When you click Deploy HEAD Commit, the system runs the commands in your .cpanel.yml file to send changes from the cPanel-managed repository to a production directory. (For example, to the directory that contains your website's public files.)

Additional documentation

Error rendering macro 'contentbylabel' : parameters should not be empty

Error rendering macro 'contentbylabel' : parameters should not be empty

There is no content with the specified labels