> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hostcloud.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy your website from Git

> Clone a GitHub, GitLab or Bitbucket repository into your hosting and publish updates with Git Version Control in cPanel.

If your website's code lives in a Git repository, you can pull it straight into your HostCloud hosting instead of uploading files by hand. This guide shows you how with **Git Version Control** in cPanel.

> [!NOTE]
>
> This guide is for developers. If you just want to upload files, see [Upload files with File Manager or FTP](https://kb.hostcloud.in/cpanel/upload-files.md).

## Step 1: Let your hosting read the repository

**Public repository:** skip this step.

**Private repository:** your hosting needs an SSH key that your Git service trusts.

**1. Create a key in cPanel**

Create an SSH key without a passphrase in **SSH Access**, and authorise it. See [Use Terminal and SSH](https://kb.hostcloud.in/cpanel/ssh-and-terminal.md).

**2. Add it to your Git service**

Copy the **public** key and add it to your repository as a read-only deploy key, in your Git service's repository settings.

## Step 2: Clone the repository

**1. Open Git Version Control**

[Log in to cPanel](https://kb.hostcloud.in/cpanel/log-in-to-cpanel.md), type **Git Version Control** in the **Search Tools** box and open it. Click **Create**.

**2. Enter the clone URL**

Turn on cloning and paste the repository's clone URL. Use the SSH form (`git@github.com:you/repo.git`) for a private repository.

**3. Choose the folder**

Enter a repository path, for example `repositories/mysite`. Keep it outside `public_html`, so your Git files aren't visible on the web.

**4. Create**

Give it a name and click **Create**. cPanel clones the repository.

## Step 3: Publish to your website

cPanel copies files to your website using a file called `.cpanel.yml` in the top folder of your repository. Add one like this, replacing `cpanelusername` with your cPanel username:

```yaml theme={null}
---
deployment:
  tasks:
    - export DEPLOYPATH=/home/cpanelusername/public_html/
    - /bin/cp -R public/* $DEPLOYPATH
```

This example copies everything in the repository's `public` folder to `public_html`. Change the folder names to match your project. Commit and push the file.

> [!WARNING]
>
> Deploying overwrites files with the same names in the target folder. [Take a backup](https://kb.hostcloud.in/cpanel/take-and-restore-backups.md) before your first deploy, especially if `public_html` already has a website.

## Update your site

**1. Push your changes**

Commit and push to your Git service as usual.

**2. Pull them into your hosting**

In **Git Version Control**, click **Manage** next to your repository, open the **Pull or Deploy** tab and click **Update from Remote**.

**3. Deploy**

Click **Deploy HEAD Commit**. cPanel runs the tasks in `.cpanel.yml`.

> [!TIP]
>
> You can also run `git pull` and your own build steps in cPanel's **Terminal**. See [Use Terminal and SSH](https://kb.hostcloud.in/cpanel/ssh-and-terminal.md).

Still stuck? [Open a ticket](https://kb.hostcloud.in/support/open-a-ticket.md) with your domain name and the error shown in Git Version Control.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.