Overview
The Git™ Version Control feature in cPanel allows you to easily manage and deploy code from Git repositories. This is especially useful for deploying websites or applications by integrating version-controlled code directly from platforms like GitHub, GitLab, or Bitbucket into your cPanel hosting environment.
With Git deployment, you can:
- Automatically push code changes from your local machine.
- Manually pull code updates from a remote repository.
- Maintain code integrity and control in development and production environments.
Methods to Use Git Deployment in cPanel
Method 1: Using Your Local Computer as an Intermediary
In this workflow, your local machine acts as a bridge between a remote repository (e.g., GitHub) and the cPanel repository.
- Pull the latest code from your remote repository to your local computer using:git pull origin main
- Push the changes from your local machine to the cPanel-hosted repository using:git push cpanel-repo main
Method 2: Connecting cPanel Directly to the Remote Repository
This method allows you to link your remote repository (e.g., GitHub) directly to cPanel, and then:
- Deploy updates by clicking “Update from Remote” inside the Git Version Control interface.
To set this up:
- Log in to cPanel.
- Go to Git Version Control under the Files section.
- Click Create and enter the remote repository URL.
- Once created, click “Manage” and use the “Pull or Deploy” options as needed.