Hi Everyone! Do you remember GIT? GIT is a type of Versions Control System (VCS) that can record any changes from the project that is currently being worked on. GIT is open source and can be used free of charge. With the presence of GIT, the developer's job is easier. You can change the version of the project automatically without having to manually save, duplicate projects, and save projects in stages. Now, at KincaiHosting cPanel Hosting comes a new feature, namely GIT Version Control. So for those of you who like to play GIT and are lazy to access SSH, you will be facilitated by the new menu from cPanel Hosting. In this guide, you can follow how to use GIT Version Control in cPanel.
Remember, GIT Version Control can only be used at a minimum of the Super Hosting Package
How to use GIT Version Control in cPanel
The way to use GIT Version Control in cPanel is,
In this guide, we will do a remote from the local computer to the hosting. For example, you have a script on your computer, then you want to make hosting as a remote repository like Github or Bitbucket . You have to do the command
PUSHso that the script that you change can be integrated from the local computer to the hosting. So, you can make script changes on your computer / laptop then sync to hosting.
1. Login cPanel Hosting
The first step you have to do is login to cPanel. CPanel login can be via https: // domainname / cpanel, according to the email sent from KincaiHosting regarding Hosting Account Information. For those of you who don't know how to log in to cPanel, please read on How to Login cPanel Hosting .
2. Select the GIT Version
After entering cPanel Hosting, please write "git" in the search field. Then a menu will appear
GIT Version Control. Please click on the menu.
3. Creating a Repository
Wait a moment until you are redirected to the Git Version Control page. Please click
In the section
Repository Path, please write the path / location of the repository in cPanel Hosting that you want. Then in the Repository Name, please write the name of the repository. If so, please click Create.
4. Duplicating Project to Hosting
Please wait a moment then there will be a push command guide that you can do. You only need to copy some of these commands in the terminal / console on the computer.
If you already have a project , please enter the project with the command:
After that add the origin setting. This time the remote repository is hosting.
git add origin e ssh://[email protected]:64000/home/websites/namarepo
After that, please do a push to the hosting.
git push -u origin master
If you don't have a project yet , and the repository is new, you can follow the command that says
To start a new project.
Please clone / duplicate the repository that is hosted on the local computer first,
git clone ssh://[email protected]:64000/home/websites/namarepo
Then enter the directory with the command,
Note: namarepo is the name of the repository that was created on the hosting
5. Create a .cpanel.yml file
This .cpanel.yml file is used to direct the repository where it will be deployed. For example, on the main domain or on a subdomain. This .cpanel.yml file is created on your local computer. Please create a .cpanel.yml file then copy the script below,
- export DEPLOYPATH=/home/websites/tutorial.websitesaya.net
- /usr/bin/rsync -Paz * $DEPLOYPATH --delete
In the section
export DEPLOYPATH=/home/websites/tutorial.websitesaya.net please adjust the URL of the desired domain directory or subdomain.
Then create a README file. This README.md file aims to make it easier for readers about the details of the project.
After that add the README file with the following command,
To add notes about the changes made, you can commit,
git commit -m "Initial Commit"
When finished, you can push to hosting. Push means that you will move the modified script from the local computer to the hosting.
git push -u origin master
During the push process, you also have to enter the cPanel password. Please enter the cPanel password and if successful it will appear as follows,
After the push is done, try checking the Directory Files.
In the case of this guide, the repository used is / home / websites / namarepo. After being pushed, in the repository there is a .cpanel.yml file.
Meanwhile, the subdomain you want to use is tutorial.websitesaya.net. This subdomain contains the website files uploaded to the repository.
Please click Manage on the Repository list. There are several things that are important here.
Repository Path : is the location of the directory / folder used as the repository
HEAD Commit : used to view information from the commit command that was performed. Git Commit provides a record of the project version. So, you can know the SHA-1 line that is used to commit, the commit date ( Commit Date ), and the commit message (note given).
Clone URL : is the URL that will be used to perform the git clone command
To view History, please click History. There is a history or track record of what was done to the repository. For example, adding certain files, doing what changes, who made changes and so on.
Delete the Repository
To delete the created repository, please click
Delete. Wait a minute until it says Are you sure that you want to delete the "repobaruu" repository? All of the repository's files will be permanently deleted . Then click
Using Git Version Control in cPanel is very easy. Especially with the presence of a new menu at cPanel Hosting, you no longer have to create a new repository via SSH access via the console. This makes it very easy for you, especially beginners who want to learn about Version Control . For those of you who don't know what SSH is, please read Find Out More About SSH . If your hosting can't SSH, it means your hosting needs an upgrade! Please upgrade Cheap Hosting to at least a Super Hosting Package so you can SSH!