To use or do anything in Git, you need repositories, either on your local computer or one hosted on your GitHub, GitLab or bitbucket account.
Do you wish to deploy these public repositories on your live server via cPanel?
Click here to for the steps to deploy PRIVATE REPOSITIORIES TO CPANEL
Have you been using the manual method of downloading your repositories from GitHub, GitLab or Bitbucket, then uploading manually via the cPanel file manager tool?
If the answer is YES, then this is for you, I will show you how you can deploy your repositories to cPanel automatically with some simple steps.
If you have the appropriate permissions, you can host a local git repository with an online remote repository (Github / bitbucket etc) on a cPanel account.
A refresher; Git is an open-source Version Control System(VCS) that tracks contents (files and directories) histories and versions, It manages changes to a project without overwriting any part of the project. It allows developers to collaborate and work on a project simultaneously.
So, How do you deploy your git repositories on cPanel?
The following steps help you deploy and manage your projects with ease.
On your Local machine (Using your preferred text editor)
· Add a .cpanel.yml file into the root folder of your repository and
· Add the following to the .cpanel.yml
Replace “cpanelUser” with your cpanel username.
· Git Add, commit and push these changes to github.
On your cPanel account
· Log into cPanel
· Select Git Version Control under Files
· Click on CREATE
· Copy the git clone URL into the Clone URL
· Copy the git clone link
· Fill in a file path for the repository (remember the cloned repository provides its own directory)
· Fill in a name for the repository as it will appear in your cPanel interface
· Click Create
· In front of the newly created repository, click on “MANAGE”
· Click on “UPDATE FROM REMOTE”, this will get the latest version of the repository from github or gitlab etc.
· You will get a success message if the repo is fecthed successfully.
· Click on “DEPLOY HEAD COMMIT”, This command pushes your revisions to the copy of the repository that exists on your cPanel account.
· You will get a SUCCESS MESSAGE, if it successfully deployed.
Awesome, right?
Click here to for the steps to deploy PRIVATE REPOSITIORIES TO CPANEL
Now you’re ready to deploy your first git repo to cPanel :-)