Direct Git support now enabled on our web hosting platform!
As a developer-friendly web hosting provider, we at iClickAndHost support many tools and features on our standard cloud-based web hosting environment, that we hope to make the life of the fellow developer easier, Tools like NodeJS, SSH, Ruby and Python support, PHP version selector and configurator, full DNS management, free VPN and much more.
Now we are happy to announce that we have made it possible for developers to directly push, pull or clone their projects from GitHub, or any other platform that’s hosting their repository, to one or more web hosting accounts on our servers.
As a version control system, Git manages and stores revisions of all types of projects, including code files, text files, image files, etc. It keeps “snapshots” of every change in the project’s history, so you never risk losing or overwriting anything.
This is all best done via SSH, which opens a secure connection and executes the required Git operations on the server.
The use of SSH eliminates the need for deploying a daemon service on the server to push requests.
Using Git to deploy a simple script or an entire app on a web hosting server is a fast and easy way to spread that version controlled content over a few web hosting accounts at the same time.
This will save developers precious time and will provide great convinience, eliminating the hassle of uploading the content to all the accounts successively over FTP. The same holds true for updates – instead of having to use FTP to upload script or app updates to each web hosting account separately, the developer will just need to push an update from the Git repository with a simple Git+SSH command.
How to create a Git repository on our web servers?
With Git now supported on iClickAndHost's innovative cloud-based web hosting platform, you will be able to create your own repository directly on the server where your websites are located, instead of using third-party services like GitHub.
First of all, you will need to have SSH access enabled for your web hosting account.
With all other packages, SSH is available as an upgrade.
Here, we’ll examine a very basic Git repository usage scenario that will allow us to track and deploy a local (as in residing on our workstation) copy of a dev app in our production environment on the hosting web server.
Step 1: Prepare the remote (web server) Git and SSH environments
Let’s assume that our production app directory resides in ~/www/my-domain.tld/ and that our Git repository is located in ~/git_repos/my_app/.
We need to execute the following in our web server environment:
After you supply your password and are logged in, you may proceed with:
This will initiate the Git repository and will allow us to take advantage of all the ‘goodies’ that the Git tool suite provides.
Now we need to tell Git to accept pushes to our working directory (~/www/my-domain.tld/):
The next step is to create a post-receive hook that will help us deploy my_app’s code directly into our working directory:
Fill the file with the following contents:
Save it and make the hook file executable:
And a small step that will help us set up SSH:<
Step 2: Prepare the local (workstation) Git and SSH environments
Let’s assume that the app you’re developing resides in ~/projects/my_app/ and contains only one example file: index.php – we’ll set up a Git repository in the same directory:
We need to generate a cryptographically strong SSH public/private key pair:
This will create two files: ~/.ssh/id_rsa (private key) and ~/.ssh/id_rsa.pub (public key).
Create a ~/.ssh/config file and add the remote host info:
If you already have this file, you only need to update it using the information above.
Now add the SSH public key to the production environment:
Step 3: Deploy your app’s code to production
Now we only need to push my_app’s code into production via Git:
That’s it! Your app (index.php in this example) is now deployed on the remote web server in the ~/www/my-domain.tld/ directory.
Sign-up Today for SSH enabled Git supporting web hosting package, with unlimited hosted domains and 30 day free trial!