This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

How to Deploy PHP Application From GitHub to Cloudways

Updated on  July 19, 2018

3 Min Read
Reading Time: 3 minutes

If you are a developer of any level you must know about git for source code management. Git is very popular when it comes to interact with multiple team members and open source contributors for building coding solutions. I’ve written a short series on Git for beginners covering, commands cheat sheets, Branches, Conflicts etc.

The best thing about GIT is It allows to create custom workflows manually or by integrating 3rd party tools for automatic deployment and Continuous Integration in PHP.

The Cloudways Platform allows you to deploy code to your application from your git repositories. Your git repository must support git over SSH for this to work. For git deployment, you need to follow simple steps given below.

Step 1: Signup & Launch Server

Firstly, Signup at Cloudways platform, Launch your first Server and application which you need. Next, Move to the Application by selecting any app from application page.

Step 2: Generating SSH Keys

In this Step you need to download SSH keys by moving to Deployment via Git tab,

We will use these keys to allow access from your Cloudways server to your git repository.Now click on the Generate SSH Keys button to generate the keys.

Now, click on Download SSH Keys to download the SSH Public Key that we will use in the next step.

Step 3: Upload SSH Key To GitHub Repository

On Github move to the repository which code you need to deployed. If you are using another git service, you will have to find the equivalent way of completing them. Go to Settings -> Deploy keys and Click on the Add Deploy Key button to add the SSH key we downloaded. You can give a name to this key too in the title field and copy the key to the box. Click on the Add Key button to save the SSH key.

Step 4: Copy the SSH Address Of Repository

Copy the repository address as shown in the image below. Make sure to copy the  SSH address as other formats (like HTTPS) are not supported.

Step 5: Deploy Code from Your Repository

  1. Back on Cloudways console, paste the SSH address you got in Step 4 into the Git Remote Address” field.
  2. Then choose the branch of your repository you want to deploy from. In this example, we use the master ” branch.
  3. Next, type the deployment path (i.e. the folder in your server where the code will be deployed). Make sure to end it with a /. If you leave this field empty, the code will be deployed to public_html/.
  4. Finally, click on the Start Deployment button to deploy your code to the selected path.

Step 6: Repository Successfully Cloned

You will get a notification once the deployment process has been completed.

You have further options to delete the repository from the server (no files will be deleted, see FAQ below), pull the latest changes or change the branch you deploy from.

Automatic Deployment Tools Integration

Cloudways also supports Github automatic deployment tools. You can easily integrate them by just using the master credentials provided on your server page. The guides are also available for automatic deployment with deploybot, deployhq and envoyer. You can easily follow the steps and setup the deployment with zero downtime on cloudways. Remember you need your server ssk key in most of the cases you can get from Deployment with git tab as shown in step 2.

 

Share your opinion in the comment section. COMMENT NOW

Create PHP websites without the worry of server management.

Deploy your PHP app on optimized PHP hosting servers.

About The Author

Shahroze Nawaz

Shahroze is a PHP Community Manager at Cloudways - A Managed PHP Hosting Platform. He’s always in search of new frameworks and methods to implement them. Besides his coding life, he loves movies and playing soccer with friends. You can email him at shahroze.nawaz@cloudways.com

Stay Connected:

Get Our Newsletter
Be the first to get the latest updates and tutorials.

THERE’S MORE TO READ.