Git Repositories in cPanel:

Git is a version control system for tracking, maintaining, and updating the conflict-free changes in the project, which are done by all the developers working on the project.

cPanel is an online Linux-based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting server a web site.

cPanel now officially provides the support to host Git Repos over the web servers. You can also manage the c Panel Git Repos either through the c Panel’s Git Version’s Control Option or also by using the commands after SSH to the server. Also, all the necessary required documentation for using Git in cPanel is available at official c Panel Documentation.

At this step, you have successfully created the Git repo in cPanel.
Note: You may also create Git repo at cPanel by SSH and to the server and using commands as mentioned below:
Once you have logged into the server via SSH using any tool like PuTTY.

Type this command in the directory that you want to use as Git Repo:

git init
Now you have successfully created the Git Repo on Web Server, using commands, instead of GUI.

In the next step, as a Case 1, you will either clone your existing local computer’s Git Repo to Git Repo Created on Server / cPanel
OR
As a case 2, you will clone the cPanel / Web Server Git Repo to your local PC’s newly created Git Repo.

The steps for both cases are described below:

Case 1: To PUSH Local Repo to cPanel Repo

Step 1: Navigate to your repository’s directory by this command:
cd /path/to/your/repo

Step 2: Configure your local repository to push to the cPanel-hosted repository:
Command 1:
git remote add origin ssh://[cPanelLoginUserName]@[WebsiteName]/[RepoPath]/[RepoName]
Command 2:
git push -u origin master

Case 2: To clone cPanel’s Git Repo to Local Git Repo:

Step 1: Clone the cPanel-hosted repository to your local computer and navigate to its directory:

git clone ssh://[cPanelLoginUserName]@[WebsiteName]/[RepoName]
Change your location to Git Repo Directory
cd [RepoName]

Step 2: Create a README file:
echo “# README” >> README.md

Step 3: We enable the update, called as Staging the Update, in order to commit it than
git add README.md

Step 4: Commit the README file to the project:
git commit -m “Initial Commit”

Step 5: Push the Commit to Head Branch, hosted over C Panel Git
git push -u origin master