Deploying a website on cPanel using Git version control is a powerful way to manage and update your site efficiently. Below is a concise guide for deploying websites using Git on cPanel, covering both public and private repositories.
Deploying Websites on cPanel Using Git (Public Repositories) #
Log in to cPanel
Access your cPanel account using your credentials.
Navigate to Git Version Control
In the cPanel dashboard, locate and click on Git Version Control under the Files section.

Create a Repository
- Click Create to set up a new repository.
- Choose Clone a Repository to clone an existing repository from GitHub, GitLab, or another Git hosting service.

Enter Repository Details
- Clone URL: Provide the clone URL of your public repository (e.g.,
https://github.com/username/repository.git
). - Repository Path: Specify the directory where the repository will be cloned (e.g.,
public_html
or a subdirectory). - Repository Name: Enter a name for the repository (this is for display purposes only).

Create the Repository
Click Create to clone the repository to the specified directory.
Manage the Repository
Once created, you can:
- Manage: Pull updates, view branches, or configure deployment settings.
- View History: Check commit history.
- Delete: Remove the repository if needed.

Deploying Websites on cPanel Using Git (Private Repositories) #
To deploy a private repository, you need to set up SSH access.
- Generate an SSH Key
- Access your cPanel Terminal or SSH into your server.
- Run the following command to generate an SSH key:
ssh-keygen -t rsa -f ~/.ssh/cpanel-private-deploy -b 4096 -C "your-email@example.com"
Replace cpanel-private-deploy with your repository name.- Save the key without a passphrase for easier automation.
- Create an SSH Config File
- Create the SSH configuration file:
touch ~/.ssh/config
- Set the correct permissions:
chmod 0600 ~/.ssh/config
- Update ownership:
chown username:username ~/.ssh/config
- Edit the
~/.ssh/config
file and add: Host *
IdentityFile ~/.ssh/cpanel-private-deploy
- Register the SSH Key with the Git Host
- Copy the public key (
~/.ssh/cpanel-private-deploy.pub
) and add it to your Git hosting service (e.g., GitHub, GitLab) under SSH keys in your account settings.
- Copy the public key (
- Test the SSH Key
- Test the connection to your Git host:
ssh -i ~/.ssh/cpanel-private-deploy -T git@github.com
- If successful, you should see a confirmation message.
- Clone the Private Repository
- Use the SSH URL to clone the repository:
git clone git@github.com:username/repository.git
- Set Up Deployment in cPanel
- Follow the same steps as for public repositories to configure the repository in cPanel’s Git Version Control tool.
NOTE: If you encounter issues, Please refer to cpanle official Guides. We’re NOT responsible for Git Configurations on your cPanel.
cPanel Reference Guides #
- cPanel Git Version Control Documentation
- Guide to Git Deployment on cPanel
- Set Up Access to Private Repositories
By following these steps, you can easily deploy and manage your website using Git version control on cPanel, whether your repository is public or private.