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.
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.
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.
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.
Once you perform the action above, you will be redirected to a new page.
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.
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 GitHub, GitLab, 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.
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:
To create a brand new repository, please make sure to toggle the “Clone a Repository” toggle switch off.
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.
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.
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 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.