Do you know shared hosting users can now leverage git application for their project deployments?
A lot of developers working on a shared hosting environment often upload their application after series of coding locally.
Another set of developers prefer to create a direct synchronization through an FTP account which allows them to update changes directly to a remote directory.
Most times, the entire process of uploading source codes to the directory can be frustrating especially if you have multiple instances of web-applications running on different subdomain directories on your shared hosting environment.
Do not be frustrated, the long-awaited shared hosting synchronization with a git repository is now available on Whogohost, Africa’s largest web hosting company.
For many other developers, deploying via git is a lot easier for them since they can have different working versions of their apps in the same repository. They can also select which branch of the repository they want to deploy live.
In this article, we will be using a sample git repository on Github, the most popular git platform as I will be showing a few steps on how to deploy a webpage directly from Git repositories. You can use the built-in version control or integrate with other git platforms such as bitbucket and Gitlab. The next article will contain a step by step process to full application deployment with DB integration.
Firstly, I will want to assume that you have a prior knowledge of git and a shared hosting environment and that also means you are familiar with Cpanel. Let’s get started.
Login to your website’s Cpanel and select Git’s version control which can be found in the files section of the Cpanel.
Create a new a new repository by clicking on the create link.
I have cloned a bootstrap starter template into sample webpage-repository on Github which can be found here
Create a new git repository on GitHub
We will, therefore, copy the repository’s clone URL https://github.com/Adewagold/sample-webpage.git and make use of it in the following image.
By setting the repository path to public_html/webpage means our repository will clone the app from github to a webpage folder in the public_html directory. You can set this path to subdomain directory or whatever works for you.
You can now go back to the previous page to view the list of repositories, Click on the manage button.
You will see available branches in your repository, you can select any branch you want to deploy and the changes will be effected automatically when you visit your website.
If you encounter a forbidden error page when you visit website http://yourwebsite.com/webpage, change the webpage’s directory to 755. You can achieve this from the file manager.
I hope you enjoyed this guide and found it useful? Now that the website is up and running, do share this post. Do you have any contributions that you might like to add or a question? Drop a comment and I will get back to you. You can also send an email to email@example.com if you need further assistance.
Will this work for a react app too, if so will i need to run npm build first??