Category:


The Git Version Control feature enables developers to host Git repositories on their cPanel accounts easily. Git can be used to manage any collection of files, including website files and assets, software development projects, and essential text files. The Git version control is handy for developers, making cloning repositories easier and more accessible to beginners. Visit cPanel Git Version Control to learn more.
I will introduce a simplified method for cloning your repository from GitHub:
Delete the known_host file from the file manager --> .ssh folder.
and then open Terminal from your cPanel (if you don't have terminal access, ask your hosting provider)
Run the command below to generate a new SSH key and press enter thrice.
Copy the content to the .ssh folder from your cPanel File Root, Edit id_rsa.pub and copy the content.
Go to your git repository settings --> Deploy key --> add deploy keys --> and paste the copied content. And then, run the below command.
If it returns this Hi username/repository You've successfully authenticated, but GitHub does not provide shell access. You're ready to go.
To automate the deployment process, you must have a .cpanel.yml file in the top-level directory of your repository.
Create a .cpanel.yml file and set up this code below:
Replace
Place the file at the root of your project
The file must be in the repo before you clone it with cPanel
Be sure to edit the file to leave only the lines you need, and don't leave all the commands active
There must be no unmerged pull requests, or the deploy button will be deactivated
No errors in the file or the deploy button will be deactivated.
Now go to git version control from your cPanel.
And give the same information about your git repository as shown below:
Enter your git repository URL :
Enter the desired path for the repository's directory. If you enter a way that does not exist, the system will automatically create the manual when it creates or clones the repository.
This name does not impact functionality but functions only as a display name.
If everything looks good, go ahead and click on "Create."
A list of all Git repositories currently connected to cPanel will appear. When you click Manage, you will be given a choice to Pull and deploy from the Git repository. Next, we will automate the process.
This tutorial has been tested on a private repository, and the result showed that it works.

I discuss Web Tech & Productivity | I've developed 100+ websites, interacted with 37 founders, and worked with three startups. It's time for you to speak up; let's get started!