Instructions for setting up GIT with WP Engine

  • Log into wpengine or go here: https://wpengine.com
  • Get your SSH key, if you need any help check this out: https://help.github.com/articles/generating-ssh-keys/
  • Add the SSH Key to here your-site-install > "git push" or you can go to this link https://my.wpengine.com/installs/your-site-here/git_push
  • Click on "Backup points."
  • Click on "Backup now."
  • Once that is done click the checkbox next to your new backup.
  • Click on "download zip."
  • Open your git client/ gui (doesn't matter which one you use, you could use command line or bash if you want).
  • Now click on "create" a repository.
  • Copy the files from your backup and paste them in your repository.
  • Now you need to remove this folder "mu-plugins." Go to wp-content > mu-plugins.
  • Download the .gitignore file that you want to be using.
  • In your command line window type this in, it will take 2 to 5 minutes for it to finish giving you your response (https://my.wpengine.com/installs/your-site-here/git_push):
  • The information that this gives is what you will need to make your remote commands. Make you first commit message:
    • cd local_wordpress_path/my_wp_install_name
    • git init .
    • git add . --all
    • git commit -m "Type your message here."
  • Create your remote commands for your git. You will need two, one for the staging area and the second for the production area (live environment). You can find the commands from this document (https://wpengine.com/git/) or you can use what is below.
  • Remote one:
  • Remote two:
    • cd ~/wordpress/my_wp_install_name
    • git remote add production git@git.wpengine.com:production/my_wp_install_name.git
    • git remote add wpengine-prod git@git.wpengine.com:production/my_wp_install_name.git
  • Deploying to the stage environment, use the command below:
    • git push staging master
  • Once you have created your remote commands you no longer need to do that step, instead you would just do this:
    • git init .
    • git add . --all
    • git commit -m "Type your message here."
    • git push staging master
  • Now check that your site is updated.

Returning to a project: 

Follow the instructions below, you will need to do this in a bash terminal. 

  • cd local_wordpress_path/my_wp_install_name
  • ssh git@git.wpengine.com info
  • git init .
  • git add . --all
  • git commit -m "Type your message here."
  • git push staging master
  • Now check that your site is updated.

Other GIT Commands:

Type out the commands. Do not copy and paste them into the command line or it just breaks them!!!!

  • git remote
  • git remote –v
  • git push wpengine-stage master -–force   ← this command doesn’t work
  • git push staging master -f
  • git rm –-cached wp-config.php   ← this command doesn’t work
  • git rm -r --cached wp-config.php
  • git status
  • git rm
  • git log -–name-only
  • git log -–name-status
  • git clone <repo_here>
  • git push production master
  • git push staging master
  • git pull production master
  • git pull staging master
  • git remote add wpengine-stage git@git.wpengine.com:staging/my_wp_install_name.git
  • git remote add stage-site git@git.wpengine.com:staging/my_wp_install_name.git
  • git remote add staging git@git.wpengine.com:staging/my_wp_install_name.git
  • git remote add wpengine-prod git@git.wpengine.com:production/my_wp_install_name.git
  • git remote add live-site git@git.wpengine.com:production/my_wp_install_name.git
  • git remote add production git@git.wpengine.com:production/my_wp_install_name.git
  • git init .
  • git add . --all
  • git commit -m "initial commit..."

Other helpful links: