WP Engine Git – A How-to Guide and Review

So here’s the deal.  My hosting company of choice, WP Engine, has a git service built into all of their websites.  This is pretty cool.  But I’ve got to be honest with you – I have had a hell of a time getting it to work properly.

Admittedly, part of the problem is me.  I am a git beginner, with just under 3 months of hardcore git usage under my belt.  I regularly screw my local repositories up.  🙂  But I also have about 40 different remote git repositories that I manage and collaborate with teams on a daily basis on both Github and Bitbucket.

But part of the problem has been WP Engine.  Their support on git-related matters has been horrible.  I was unable to get any helpful answers to my git questions either via live chat support or ticket support.  One member of the WP Engine team even told me, point blank, “We don’t support git” – a statement that both my sales rep and WP Engine’s Twitter account denied.  Nonetheless, their support on git questions has been downright horrid.

The good news is that after I invested about 20 hours on the matter, I can now safely and consistently push my local git repositories out to WP Engine.  The bad news is that it took a shit ton of time to figure it all out.

Here are the basics.  Some of what I am about to tell you are git basics, and some are WP Engine+git basics.

  1. You need to generate an SSH key on your computer.  To do this, follow steps #1-3 here.  Step #3 will actually copy your SSH key to your clipboard (for pasting later).
  2. Set up the git user on the WP Engine dashboard.  NOTE: You only need one git user for ALL of your sites.  I learned this the hard way.  When you go to set up another git user on WP Engine, just follow step #3 from the link above to copy your computer’s SSH key.  Again, do not set up another SSH key on your computer!
  3. From there, you can pretty much follow these instructions.  But understand that it’s gonna be messy.

Some things I learned:

  1. WP Engine’s git feature is not a replacement for Github or Bitbucket.  It is to be used in conjunction with those services.  For example, I have a repository on Bitbucket that I use to manage all of my branches.  Right now, my workflow has all of my code up on Bitbucket.  I push to WP Engine only after I have already pushed to Bitbucket.
  2. You can push any local branch to either WP Engine’s staging environment or its production environment.
    • To push your local “staging” branch to the WP Engine production site, type, “git push production staging”.
    • To push your local “master” branch to the WP Engine production site, type, “git push production master”.
    • To push your local “staging” branch to the WP Engine staging site, type, “git push staging staging”.
    • To push your local “master” branch to the WP Engine staging site, type, “git push staging master”.
    • To push your local “feature-my-branch-name” branch to the WP Engine staging site, type, “git push staging feature-my-branch-name”.
    • Got it?
  3. WP Engine’s git functionality is a replacement for SFTP.  This is actually an awesome thing.  It’s not that SFTP is hard (it’s not).  It’s that git and FTP don’t play nice together.  If you use git locally and ftp files, you are liable to ftp up branches and features that you did not intend to.  So, stop FTP’ing into WP Engine – use “git push” instead.
  4. You can push feature branches to WP Engine git, but don’t; use Bitbucket/Github to manage branches, instead.  Think of WP Engine as live code only.

Resources

Posted in

The Mighty Mo! Design Co.

RSS From Toby’s Blog

  • The Horrors of Covering Your Own Ass
    Today I emailed a very simple question to support@[companyname].com (2 sentences total). The automated response I got back was this: Keep in mind that the above was an auto-response and: It’s hard to read. Everything has the same import (e.g. none of it is important enough to call out separately). It’s long. It added absolutely-zero…
  • If something stupid makes money, then it’s not stupid.
    I’ve seen some stupid things in my life…And some of them were really really smart. I remember a story from decades ago where the U.S. military was looking to equip the Stealth Bomber with a fancy computer-driven video system so the pilots could see behind them. Well, the computers failed to get the job done,…
  • There is no destination.
    Coding is a process of failure followed by a moment of great joy. You've gotta ride through the failures to experience the joy...

More posts from themightymo.com

Website DNS, Domain Registration, & Hosting Basics

By Toby Cryns | November 30, 2021

Websites have multiple layers: Domain Registration When you register a domain, you pay someone ~$20/year for a .com domain. Registration means you are leasing the domain for a year or more. A domain is the “yoursite.com” or “yoururl.net” or “yourorganization.org” that people type into their browser. We use services like Namecheap, Dreamhost, and GoDaddy for…

Avada ThemeFusion loads 80+ javascript files on every page! DON’T RECOMMEND!

By The Mighty Mo! Design Co. | November 18, 2021

I inherited a WordPress site using Avada ThemeFusion, and it is experiencing really bad performance issues. After doing lots of my standard bag-of-tricks optimizations to little effect, I decided to simply count the javascript files. To my surprise horror, I found it was loading over 80 javascript files on every single page! (For comparison: themightymo.com…

Why I switched from WPMUDEV’s Defender Pro to WordFence for WordPress Security

By The Mighty Mo! Design Co. | November 12, 2021

A while back, I started using WPMUDEV’s Defender Pro plugin for security on all my WordPress sites. I made a decision this week to switch to WordFence. The conversation was forced on me, because I had a site using Defender Pro that was hacked. I do not blame Defender Pro for the hack, however, this…

RSS From Toby’s Blog

  • The Horrors of Covering Your Own Ass
    Today I emailed a very simple question to support@[companyname].com (2 sentences total). The automated response I got back was this: Keep in mind that the above was an auto-response and: It’s hard to read. Everything has the same import (e.g. none of it is important enough to call out separately). It’s long. It added absolutely-zero…
  • If something stupid makes money, then it’s not stupid.
    I’ve seen some stupid things in my life…And some of them were really really smart. I remember a story from decades ago where the U.S. military was looking to equip the Stealth Bomber with a fancy computer-driven video system so the pilots could see behind them. Well, the computers failed to get the job done,…
  • There is no destination.
    Coding is a process of failure followed by a moment of great joy. You've gotta ride through the failures to experience the joy...