Ultra Web Hosting Docs

Git Version Control

The Git Version Control feature in cPanel lets you host Git repositories directly on your account. Track changes to your code, pull from an external remote such as GitHub, and deploy new versions to your site automatically.

Opening Git Version Control

  1. Log into cPanel.
  2. In the Files section, click Git Version Control.
  3. The page lists any repositories already on your account and offers a Create button to add a new one.
Note Repositories live in your home directory. Keep them outside public_html and deploy into the web root, so your .git folder and any development files are never served to the public.

Creating a New Repository

To start a brand-new repository on the server:

  1. Click Create on the Git Version Control page.
  2. Leave Clone a Repository toggled off.
  3. Enter the Repository Path where the repo should live, for example repositories/mysite.
  4. Give the repository a Name for the cPanel listing.
  5. Click Create. cPanel initialises an empty repository you can start pushing to.

Cloning an Existing Remote

To pull in a repository that already exists on GitHub, GitLab, Bitbucket, or another host:

  1. Click Create, then toggle Clone a Repository on.
  2. Enter the Clone URL. For private repositories use the SSH form, for example [email protected]:youruser/yourrepo.git.
  3. Set the Repository Path and Name.
  4. Click Create to clone the remote onto your account.
Warning Cloning a private repository over SSH requires your account's public key to be authorized on the remote host. Add the key to your GitHub or GitLab account before cloning. See SSH Keys for how to find and manage your keys.

Working over SSH

Once a repository exists on the server, you can drive it from an SSH session just like on your own machine. Connect over SSH (see SSH Access), change into the repo, and use the normal Git commands:

cd ~/repositories/mysite
git clone [email protected]:youruser/yourrepo.git
git status
git add .
git commit -m "Update homepage copy"
git push origin main
git pull origin main

Configure your identity once per account so commits are attributed correctly:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Automatic Deployment with .cpanel.yml

cPanel can deploy your repository automatically. Add a file named .cpanel.yml to the root of the repository. It defines the tasks to run each time you deploy — typically copying files from the repo into public_html:

---
deployment:
  tasks:
    - export DEPLOYPATH=/home/cpuser/public_html/
    - /bin/cp -R index.html $DEPLOYPATH
    - /bin/cp -R assets/ $DEPLOYPATH
    - /bin/cp -R includes/ $DEPLOYPATH

Replace cpuser with your own cPanel username. Commit and push the .cpanel.yml file, then trigger a deployment either from the Manage screen of the repository in cPanel (the Pull or Deploy tab) or from the command line:

cd ~/repositories/mysite
git pull
/usr/local/cpanel/3rdparty/bin/git-deploy
Tip Deployment only runs after the working tree is up to date, so pull your latest changes first. Use absolute paths in .cpanel.yml tasks and always list the exact files and folders you want copied to avoid overwriting anything unexpected in public_html.

Getting Help

If a clone fails with an authentication error, a push is rejected, or a deployment does not update your site, double-check the SSH key on the remote and the paths in your .cpanel.yml. If you are still stuck, open a support ticket with the repository name and the exact error message.