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

# Git Version Control

> Host Git repositories inside your cPanel account, deploy from external Git providers, and manage SSH keys for secure access.

Git Version Control on cPanel lets you do two things:

1. **Host bare Git repositories** on your server. Useful as a private origin you can push to from anywhere.
2. **Clone existing repositories** from GitHub, GitLab, Bitbucket, or self-hosted Git into your account, with optional auto-pull deployment to a public folder.

Open it from cPanel home → **Files** → **Git™ Version Control**. A fresh account starts empty with a **Create** button.

<Frame caption="Git Version Control with no repositories yet">
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/noxity/images/cpanel/file-management/git-version-control/empty-light.png" alt="Empty Git Version Control page with Create button" className="block dark:hidden" />

  <img src="https://mintlify.s3.us-west-1.amazonaws.com/noxity/images/cpanel/file-management/git-version-control/empty-dark.png" alt="Empty Git Version Control page with Create button" className="hidden dark:block" />
</Frame>

## Create a repository

<Steps>
  <Step title="Click Create">
    From the Git landing page, click **Create**. You'll be asked whether to clone an existing remote or start fresh.
  </Step>

  <Step title="Pick the source">
    * **Clone a Repository.** Paste an HTTPS or SSH URL like `git@github.com:you/your-repo.git`. For private SSH repos, you'll need an SSH key set up first (see below).
    * **New Repository.** No remote, just an empty repo on the server you can push to from your laptop.

    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/noxity/images/cpanel/file-management/git-version-control/create-form-light.png" alt="Git create dialog with Clone or New repository options" className="block dark:hidden" />

      <img src="https://mintlify.s3.us-west-1.amazonaws.com/noxity/images/cpanel/file-management/git-version-control/create-form-dark.png" alt="Git create dialog with Clone or New repository options" className="hidden dark:block" />
    </Frame>
  </Step>

  <Step title="Set the path">
    The **Repository Path** is where the repo lives on disk. A sensible default is `repositories/<repo-name>`. For an auto-deploy setup, point it at the public folder (`public_html/<repo-name>`).
  </Step>

  <Step title="Name it and create">
    Give the repo a display name and click **Create**. cPanel runs `git clone` (or `git init`) and shows you the result.
  </Step>
</Steps>

## SSH keys for private repos

If you're cloning a private GitHub or GitLab repo over SSH, the server needs an SSH key the remote provider trusts. SSH keys are managed from a separate cPanel page: **Security** → **SSH Access** → **Manage SSH Keys**.

### Generate a new key

<Steps>
  <Step title="Open SSH Access">
    cPanel home → **Security** → **SSH Access** → **Manage SSH Keys**.
  </Step>

  <Step title="Click Generate a New Key">
    Pick a key name. Leave the password empty for unattended deploys, or set one if you want extra protection. Pick `ed25519` for the type. Click **Generate Key**.
  </Step>

  <Step title="Authorize the key on your account">
    Back at **Manage SSH Keys**, find your new key under **Public Keys** and click **Manage** → **Authorize**. This adds the key to `~/.ssh/authorized_keys` so the server itself can use it.
  </Step>

  <Step title="Copy the public key to your Git provider">
    Click **View** next to the public key, copy the full text, and paste it into GitHub → Settings → SSH Keys (or your provider's equivalent).
  </Step>
</Steps>

You can now clone private repos from that provider via SSH URL. cPanel uses the authorized key automatically.

### Use an existing key

If you already have an SSH key pair on your local machine, paste the public key into **Import Key** instead of generating a new one. The private key never leaves your machine.

## Pull updates and deploy

Once a clone is set up, the repo's Manage page has a **Pull or Deploy** tab.

* **Pull from Remote.** Runs `git pull` with the configured remote and branch. Use this for manual deploys.
* **`.cpanel.yml` deployment.** If your repo contains a `.cpanel.yml` file at the root, cPanel runs the tasks defined inside on every pull. Common pattern: copy files from the cloned repo into `public_html/` so the live site updates without serving the `.git/` directory directly.

A minimal `.cpanel.yml`:

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

## Things to know

* Cloned repos via the **New Repository** flow are bare. Clones from a remote are working trees.
* Cloning a repo with submodules works via HTTPS or SSH if the right keys are in place.
* Repos placed under `public_html/` will have their `.git/` folder served unless blocked by `.htaccess`. Either deploy to a separate folder, or block `.git/` requests in your web server config.
* Private repos cloned over HTTPS need credentials cached or a personal access token in the URL. SSH is simpler for unattended deploys.

## Need a hand?

<CardGroup cols={2}>
  <Card title="Open a ticket" icon="life-ring" href="https://members.noxity.io/submitticket.php">
    Best for anything that needs an account check or a config change on our end.
  </Card>

  <Card title="Live chat" icon="messages" href="https://noxity.io/contact">
    Faster for quick questions during business hours.
  </Card>
</CardGroup>
