Learn cPanel

Controlling your Web Hosting Account has never been that easy thanks to cPanel web Control Panel!

• Last Updated: 07/31/2024
• ( 10 minutes reading )

How to use the Git™ Version Control in cPanel

Introduction

Git is a distributed version control system (DVCS) used to track changes in source code during software development. Git is a powerful and versatile version control system that offers significant benefits for developers and teams. It facilitates collaboration, tracks changes, ensures data integrity, and helps streamline the software development process. In Git, every developer has a copy of the entire project history on their local machine.

This allows for decentralized development, enabling developers to work offline without a constant connection to a central repository. Git makes it easy to create branches for different features or bug fixes. Developers can work on these branches independently and then merge them back into the main codebase when they are ready, promoting parallel development and collaboration.

In this tutorial, we will review the "Git™ Version Control" feature in cPanel, which will allow you to clone or create completely new git repositories and use them on your cPanel web hosting account.

Getting Started

To take advantage of all the benefits of the git system, you will need to access cPanel first. If you are not certain how to achieve that, please follow our other tutorial, How to access the cPanel service.

Once logged in to the cPanel service, please use the search bar on the top right corner and type in “Git™ Version Control”. Doing so will filter all options and will display the feature under the “Files” functionalities. Please click on it.

 

git-version-control-functionality

 

After clicking on the “Git™ Version Control” functionality, you will be redirected to a new page where you will find a brief explanation of what Git is used for as well as a direct link to the official cPanel documentation describing the service.

 

Clone existing remote repositories or create new repositories 

The main “Git™ Version Control”  interface displays a table section containing existing repositories in your cPanel web hosting account. However, if no repositories have been created yet, please click on the “Create” button located on the top right side of the table section.

 

create-git-repo

 

Once you perform the action above, you will be redirected to a new page.

 

clone-a-repo

 

If you have an existing repository you want to clone from a remote server to your cPanel hosting account, please enable the “Clone a Repository” toggle switch.

 

Clone existing repositories

A repository contains your codes, files, and each file's revision history. Each repository allows you to manage and discuss the work you have done within it. There are two types of git repositories: private and public.

 

Public Repositories

 

Public repositories are accessible to everyone on the Internet, and anyone acquainted with git and the command line interface should be able to use them without any type of authentication.

 

Private Repositories

 

Private repositories require authentication, so it is really important to add an SSH public key to your remote Git environment in order to perform the cloning process we will go over shortly. Every Git service (like GitHubGitLab, or Bitbucket) has its own interface for managing SSH keys, and you should check where exactly the SSH public key should be imported in the respective dashboard you use for your Git service.

 

To generate an SSH key pair, please click on the “SSH access” link provided on the “Git™ Version Contro”l page. Alternatively, please use the “SSH Access” functionality on your cPanel hosting account. 

 

ssh-access-button

 

You can find the entire process of generating an SSH key pair in our tutorial on How to Manage SSH access keys for your cPanel web hosting account

 

Going forward, we assume you already generated a  SSH key pair and deployed the public key on your external Git environment. Now that this process is done, let’s give a bit of context about what cloning an existing repo means.

 

Clone existing repositories typically refers to the process of creating a copy of a Git repository from an external source, such as a code hosting platform like GitHub, GitLab, or Bitbucket and making it available on your web hosting account. This allows you to deploy, develop, or test a specific version of a codebase on your web server. 

 

To make this more understandable, let us go over all the options in the interface of the “Git™ Version Control” functionality in cPanel:

 

  • Clone Repository - Please make sure the toggle switch is enabled here to proceed with the repo cloning.
  • Clone URL - Please provide the URL of the Git repository you want to clone. This URL should point to the remote Git repository you wish to copy. For example, say you have a GitHub account and you want to clone the existing content from GitHub to cPanel. The URL link can be found in Github.

 

link-from-github

 

  • Repository Path - In this field, please specify the directory where you want to clone the repository on your account. This can be a subdirectory of your website's root directory or a brand new document root.

 

github-link-text-field

 

 

  • Repository Name -  In this text field, please provide a name to your repositories in order to quickly navigate between the repositories in case you have more than one. The name is not related to the functionality of the repository, however rather has an organizational purpose and is used to facilitate the work process.

 

Create new repositories

To create a brand new repository, please make sure to toggle the “Clone a Repository” toggle switch off.

 

create-new-repo-no-cloning

 

After doing the above, you will see that the “Clone URL” text field will disappear, and only the “Repository Path” and “Repository Name” fields will remain. Please fill in these fields in the exact same manner as when cloning a repo.

 

create-new-repo-no-cloning

 

When you have filed all mandatory information, please click on the “Create” button to clone or create the repository in your cPanel web hosting account account.

Conclusion

That’s it! We have explored how to clone or create Git Repositories in cPanel, and we hope that you found our tutorials helpful. If you happen to face any difficulties with this process, please do not hesitate to contact our technical support team via the ticketing system in your Client Area.

...
Nikola Zgurev
Technical Support Captain

Nikola is an accomplished tech-savvy extraordinaire with over six years of experience in the web hosting field. He started as a customer care representative and quickly rose the ranks to become a support supervisor and, eventually - the head of the technical department in HostArmada. His deep understanding of the client's needs, combined with his technical knowledge, makes him the perfect man to create the ideal harmony between client satisfaction and professional problem-solving. You will often find him creating helpful tutorials, articles, and blog posts that help existing customers get around.