Pushing WordPress Theme Updates With Git

Do you frequently update WordPress themes? It's kind of a pain in the ass, right? Typically has to be done manually through FTP or uploading a new zip through the backend.

Well, today I'm going to show you how to update your site with just:

$ git push live

Sounds to good to be true? It's not. Check it out:

Prerequisites

1) SSH Access to your web server
2) Git installed on your local machine and on your web server

This setup works best for one off customs themes (like the one on HarnerDesigns.com) and not for themes produced to be distributed.

Create Your Repo Locally

First things first, create a folder for your project and enter it:

$ mkdir git-test && cd git-test

then initialize the repo:

$ git init

Alternatively, you can just clone my Blank2 - Blank WordPress Theme repo to get started:

$ git clone https://github.com/harnerdesigns/blank2.git git-test

Create A Bare Repo On The Remote Server

A bare repo is a directory containing the working tree of your git project, just without storing all the files. It's essentially just a directory of all the files noramlly in your .git directory.

SSH into your server:

$ ssh <user>@<server>:<sshPort>

Create a folder for the bare repo and enter it:

<user>@<server> $ mkdir git-test.git && cd git-test.git

Remember where on the server you created this directory, you'll need that later (Doing it in your home directory works perfectly fine).

Initialize the bare repo:

<user>@<server> $ git init --bare

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up With Harner Designs!

Get updates about New Projects, Products, Discounts, and Giveaways from Harner Designs!

By submitting your email, you agree to our Privacy Policy and give us consent to send you marketing and promotional emails. You can unsubscribe at any time.