How You Can Host Git Repositories on Your cPanel Account

cPanel is working to release version control using Gitweb that ships with Git and will be either "git version control and deployment" or just "git version control" when it available.

With this feature, you can have a version control tools in the File Manager that allows you to pull/push/checkout/check-in repositories to the directory you choose, and keep it updated.

In the meantime though, you can use the following tutorial to host your Git repos on a cPanel account.

How to Host Git Repositories on a cPanel Account

cPanel accounts can host Git™ repositories if appropriate permissions are granted.

Git's version control software tracks changes in a system of files that multiple users can manage simultaneously.

This tutorial can create or clone a new Git repository, update the repository's configuration, and clone the repository locally for updates.

However before you can use this feature, these statements must be true without exception:

  • Your cPanel account must be active with enough available disk space.
  • Shell Access setting must be enabled for your cPanel account.
  • You must have registered your public key in cPanel's SSH Access interface (cPanel >> Home >> Security >> SSH Access) and authorize it for SSH access.

In this tutorial, "example" represents the repository name and "Project" represents the directory that contains the repository.

Creating A Repository:

To create a new repository, use the following steps:

  1. Use SSH to log in to your cPanel account on the command line.
  2. Create a new directory to store your repository using the following command:
    mkdir -p ~/Project/example
  3. Navigate to the newly-created directory with the following command:
    cd ~/Project/example
  4. Initialize the directory as a Git repository with the following command:
    git init

Updating The Repository's Git Configuration:

You can configure the Git repository to remain up to date as you push changes from the local branch.
To do that, run the following command from within the repository directory:

git config receive.denyCurrentBranch updateInstead

Cloning The Repository Locally:

To clone the cPanel-account-hosted repository, access your local computer via the command line and run the following command:

git clone ssh://username@hostname:/home/username/Project/example.git


  • username represents the cPanel account username.
  • and hostname represents the hostname for the server that hosts your cPanel account.

Cloning An Existing Repository To Your cPanel Account:

If a Git repository already exists for your project, you can clone it and host it on your cPanel account.
You can clone an existing repository by following these steps:

  1. SSH into your cPanel account.
  2. Create a new directory to store your repository with the following command:
    mkdir -p ~/Project
  3. Navigate to the newly-created directory with the following command:
    cd ~/Project
  4. Clone the repository, run the following command, where URL represents the full Git URL of the existing repository to clone:
    git clone url example.git

    If you are using Github, the URL will look like this:

Pushing Local Changes To The Hosted Repository:

To push changes that you make on your local computer to the hosted repository, use:

git push origin master -u --exec=/usr/local/cpanel/3rdparty/bin/git-receive-pack

This will push your revisions to the copy of the repository that exists on your cPanel account.

  • Github, Git, cPanel
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What is cPanel Git Version Control?

cPanel Git Version Control is designed to make hosting repositories as easy for developers as a...

Using Gitweb & cPanel Git Version Control

Along with cPanel Git Version Control is another great application that’s developed by Git called...

How To Set Up Git In cPanel

Git’s extremely useful when you configure it to transfer content between a local and remote...

Common Git Commands You Can Use with cPanel's Git Version Control

You can access all of Git™'s functionality via the command line. This document lists common...

What You Need To Know About cPanel Git Version Control

The cPanel team recently released one of its much requested features called Git™ Version Control...

Powered by WHMCompleteSolution