---
title: How to deploy website on cPanel using git version control
description: "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…"
url: "https://truehost.com/support/knowledge-base/how-to-deploy-website-on-cpanel-using-git-version-control/"
updated: "2025-02-10"
category: Cpanel
---

# How to deploy website on cPanel using git version control

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.

![](https://truehost.com/support/wp-content/uploads/2025/02/image-46.png)

**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.

![](https://truehost.com/support/wp-content/uploads/2025/02/image-47-1024x283.png)

**Enter Repository Details**

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

![](https://truehost.com/support/wp-content/uploads/2025/02/image-48-1024x592.png)

**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.

![](https://truehost.com/support/wp-content/uploads/2025/02/image-49-1024x431.png)

### **Deploying Websites on cPanel Using Git (Private Repositories)**

To deploy a private repository, you need to set up SSH access.

1. **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.
2. **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`
3. **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.
4. **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.
5. **Clone the Private Repository**
   - Use the SSH URL to clone the repository:
   - ***`git clone git@github.com:username/repository.git`***
6. **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](https://docs.cpanel.net/cpanel/files/git-version-control/)
- [Guide to Git Deployment on cPanel](https://docs.cpanel.net/knowledge-base/web-services/guide-to-git-deployment/)
- [Set Up Access to Private Repositories](https://docs.cpanel.net/knowledge-base/web-services/guide-to-git-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.
