How to Automatically Deploy WordPress Theme Changes using GitHub and Deploy

Do you need to mechanically deploy WordPress theme adjustments to your website online? Most skilled internet builders use a model keep watch over machine like GitHub or BitBucket and mechanically deploy their adjustments to staging or are living website online. In this newsletter, we will be able to display you ways to mechanically deploy WordPress theme adjustments using GitHub and Deploy.

Why Use Version Control System for WordPress Theme Development?

First, we’d like to perceive what model keep watch over method:

… a machine that information adjustments to a document or set of recordsdata over the years so to recall explicit variations later

In different phrases, each time we alter a WordPress theme template, symbol or CSS document, a model keep watch over machine helps to keep monitor of those adjustments. At explicit issues, we will be able to label (dedicate) a batch of adjustments. If the ones adjustments motive a subject, we will be able to revert (or roll again) to an present ‘model’ of our WordPress Theme.

Git is a not unusual model keep watch over machine, and permits more than one customers (internet builders) to paintings at the similar code base (comparable to a WordPress Theme). If two builders edit the similar document, Git has inbuilt controls to handle those problems (referred to as merge conflicts).

Hosted, 3rd birthday celebration Git model keep watch over methods, comparable to GitHub and BitBucket, permit customers to go away problems (or tickets) in the event that they spot an issue along with your code. Your code adjustments will also be dedicated (labelled) in opposition to a specific factor, to display the precise code adjustments made to repair a subject. This is in point of fact helpful while you glance again on code in 6 or 12 months time and need to know why you probably did one thing in a specific approach.

Why Use a Deployment System?

A deployment machine, which integrates with products and services comparable to GitHub, permits you to mechanically or manually add adjustments you’ve made to your WordPress theme.

You can see it as a a technique synchronisation machine – as an example, when you delete a document out of your WordPress Theme, you’d have to take into accout to delete it by the use of FTP too. With a deployment machine, that is mechanically accomplished for you while you dedicate your code adjustments to GitHub.

Setting up a GitHub Repository for Your WordPress Theme

First we’ll setup an account on GitHub, use the GitHub consumer for Windows or Mac to retailer our WordPress Theme in GitHub.

Head over to and join a unfastened account.

Once you’ve registered and showed your e-mail deal with, click on the plus icon in opposition to the highest proper nook of the display screen, and make a selection New Repository (a repository is a container on your code – on this case, our WordPress Theme).

Adding a new repository in GitHub

Start by means of atmosphere the repository title – your WordPress Theme’s folder title is a good suggestion.  Then, make a selection whether or not this can be a Public or Private repository. Public repositories are to be had for everybody to see your code, however they may be able to’t make adjustments to it. Private repositories are to be had only for you to see.

Finally, tick the checkbox underneath Initialize this repository with a README, and then click on the Create repository button.

Creating a new repository for your WordPress theme on GitHub

If the whole thing has labored, you must see your new repository on display screen:

New GitHub repository

Install GitHub for Windows / Mac

Next, we’d like to put our WordPress Theme’s code into our repository.  We can do that using the GitHub consumer, which installs onto your pc.

Simply talk over with GitHub Desktop website online and obtain GitHub Desktop consumer to be had for Windows and Mac.

Once downloaded, get started the set up procedure by means of clicking Continue

GitHub desktop install welcome screen

On the following display screen, input your GitHub Login (Username) and Password, which you created while you registered on GitHub. Click the Sign In button when accomplished.

Login to GitHub

If the login main points are proper, your account will probably be displayed. Click the Continue button to continue:

Logged into GitHub

We can go away the Git Config phase because the default settings.  Make positive you click on the Install Command Line Tools possibility, ahead of clicking the Continue button:

Configure git and install command line tools

Finally, click on Done, and you’ll be offered with the GitHub display screen.

Let’s upload our GitHub repository that we created previous. To do that, click on the plus icon at the most sensible proper hand nook, and then the Clone possibility. You will see an inventory of your GitHub repositories, together with the only we created previous:

Clone repositories

Click the repository you created previous, and then click on the Clone button.

Choose the place for your pc you need to retailer this repository, and click on the Clone button if you’ve selected this.

We’ve now cloned (copied) our repository hosted on GitHub to our pc.  

Next, we’d like to upload our WordPress Theme code to the repository’s folder, and then dedicate and sync this code to GitHub.

Start by means of discovering the folder you decided on within the above step for your pc. It must have a document within the folder. Depending for your pc’s settings, you may additionally see the hidden .git folder:

Clone repository folder on your computer

Copy and paste your WordPress Theme’s code into this folder:

Copy and paste your theme files in the repository folder on your computer

Open the GitHub Mac or Windows app, and you’ll now see the recordsdata you’ve simply added seem within the window:

Uncomitted changes

You will see the adjustments highlighted in inexperienced. These are the adjustments that you’ve stored in native repository however you haven’t but dedicated the ones adjustments.

Next, we’d like to dedicate (add) those recordsdata to GitHub.  To do that, input some textual content into the Summary field to give an explanation for the adjustments we’ve made (e.g. My first dedicate), and click on the Commit to grasp button.

Commit changes

This commits the adjustments you’ve made to the repository. To add the ones adjustments to GitHub, click on the Sync button at the most sensible proper hand nook of the GitHub utility window.

Sync your local and GitHub repositories

To take a look at your dedicate has been uploaded to GitHub, talk over with your repository on GitHub website online. If the whole thing labored, you’ll see your code:

Changes successfully uploaded to GitHub

Setting up Deploy

So a ways, we’ve setup GitHub and dedicated our WordPress Theme’s code to your GitHub repository. The ultimate step is to add any adjustments for your GitHub repository to your WordPress website online.

DeployHQ or just Deploy, is a internet based totally carrier which is able to observe adjustments to your GitHub repository, and mechanically or manually add simply the ones adjustments to your WordPress website online.

Imagine it as a connection in the midst of your code and internet server:

First you want to talk over with Deploy website online and signup. Deploy is a paid carrier, but it surely gives a unfastened account for one mission and 10 deployments according to day.

After completing join, you’ll login to your Deploy dashboard. Click on create a brand new mission to get began.

Add new project in Deploy

Next you want to supply a reputation on your mission and choose your code web hosting platform, GitHub. Click at the create mission button to proceed.

Deploy project name and code hosting

Deploy will now redirect you to GitHub. If you don’t seem to be already signed in, then you’ll be requested to login. After that, you’ll be requested to permit Deploy to get entry to your GitHub account.

Give Deploy permission to access your GitHub account

Click on ‘Authorize utility’ button to proceed.

Deploy will fetch the record of your repositories from GitHub and will ask you to choose a repository for this mission.

Select your repository

Simply click on for your WordPress theme repository and Deploy will import it for you.

In the next move, Deploy will ask you to supply server data. This is the place you inform Deploy how to add recordsdata to your WordPress server.

You will want your FTP credentials for that.

Deploy FTP Details

  • Name: Provide a reputation for this connection
  • Protocol: FTP or in case you have SFTP or SSH then you’ll use the ones as smartly
  • Hostname: Your internet website online’s SFTP/FTP host.
  • Port: Your internet website online host’s SFTP/FTP port (in most cases SFTP = 22, FTP = 21)
  • Username and Password: FTP username and password.
  • Deployment Path: The trail you’d navigate to ahead of importing your WordPress theme recordsdata. For instance, public_html/ matters/MyTheme, the place MyTheme is the WordPress theme you’ve dedicated to GitHub.

Click at the save button to proceed.

Deploy will now take a look at your server connection and if the whole thing works appropriately, then it is going to display you a luck message.

Server added proceed to deployment

You can now click on at the Deploy Now button to add your GitHub recordsdata to your website online.

New deployment

Deploy will display you the main points of this deployment. Simply click on at the Deploy button on the backside.

You will now see the development of deployment. Once Deploy has completed, you’ll see a luck message.

Successfully deployed

You have effectively deployed adjustments from GitHub to your website online using Deploy. Now when you’re making adjustments to your WordPress theme for your pc, you want to dedicate them to GitHub. After that you want to talk over with Deploy website online to get started the deployment manually.

Let’s see how to setup automated deployment in order that any adjustments you dedicate to GitHub are mechanically deployed to your website online.

Setting Up Automatic Deployment

First you want to talk over with your Deploy dashboard and cross to Projects web page. Click at the title of your mission.

Deploy Projects

From your mission web page take the mouse to the Settings menu and then choose Servers & Groups.

Project settings - Servers and groups

Click at the edit icon subsequent to your server.

Edit server

This will deliver you to edit server display screen. In the precise hand column you’ll in finding the Automatic deployment settings.

Make positive that it’s grew to become on. Below that you’re going to see a URL. Copy this URL as you’ll want it in the next move.

Automatic deployment settings

Log into your GitHub account in a brand new browser tab. Click for your repository and then click on on Settings. Click at the Webhooks and Services hyperlink.

GitHub Webhooks and Services

Click at the Add Webhook button.

Paste the URL you copied from Deploy server settings web page in Payload URL box. Select utility/x-www-form-urlencoded because the Content sort and hit Add webhook.

Adding webhook

That’s all, your GitHub repository will now notify Deploy when there are new adjustments to your repository. Deploy will then mechanically deploy the ones adjustments to your website online.

Testing Automatic Deployment

To take a look at automated deployment merely make some adjustments to your WordPress theme repository for your pc.

Open the GitHub desktop app and then dedicate the ones adjustments.

Testing automatic deploy by adding commits to GitHub

Don’t fail to remember to click on at the sync button.

Now talk over with your mission on Deploy dashboard. Click at the deployments and you’ll in finding your automated deployment indexed there.


That’s all, we are hoping this newsletter helped you find out how to mechanically deploy WordPress theme adjustments Using GitHub and Deploy. You might also need to see our information on how to create staging atmosphere for a WordPress website online.

If you really liked this newsletter, then please subscribe to our YouTube Channel for WordPress video tutorials. You too can in finding us on Twitter and Facebook.

Recent Articles

The Best Pinterest Alternatives to Use if You are Bored of Pinterest

Pinterest is a loved social media network among the lover of aesthetics, mostly females tbh. Now, however more and more people are...

Ways you can add links to your Instagram post in 2021

Instagram has many cool features which need no introduction. However, there are a number of features that...

Finance App You should Have on Your iPhone and Android

We live in the age of digitization. When everything is digital, it is no surprise that money has joined the club too....

5 Video Editing Softwares to Try Your Hand at in 2021

Video is the king when it comes to social media. With reels dominating Instagram and Facebook and...

Charge Your Laptop Without a Charger in 5 Ways

Forgetting your laptop charger is a pretty common thing. We all have been there and all of...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here