SSH Key Management for WP Engine GitPush

If you use multiple SSH keys with WP Engine GitPush, or use GitPush in conjunction with WP Engine SSH Gateway, you can simplify your connection process by telling your computer in advance which SSH key is used for which service. This can be accomplished using a SSH config file on your local machine. In this article we will explain how to configure your SSH config file for GitPush.


Create SSH Config File

  1. On your local machine, first navigate to your .ssh directory.
    • MacOS – Open Terminal and type:
      • cd ~/.ssh/
    • Windows – Use Git Bash and navigate to:
      • /c/Users/[youruser]/.ssh/
  2. To create the file run:
    • touch config
  3. To edit the file run:
    • vi config
  4. Inside the file, tap i to insert text
  5. Paste the following contents:
    • Host git.wpengine.com
         User git
         Hostname git.wpengine.com
         PreferredAuthentications publickey
         IdentityFile ~/.ssh/wpegitkey
         IdentitiesOnly yes
  6. To save and exit the vim editor:
    • esc button then :wq

If you are using WP Engine’s SSH Gateway and GitPush, additional SSH Config contents should be added for SSH Gateway.

If you are using a different key than what is generated in our GitPush setup guide, be sure to update ~/.ssh/wpegitkey to your own private key file path.


Add Remotes

Now that you have a config file set up for your SSH keys, you can manage your remote repositories easier. Just use your Host alias name when adding your remote repositories.

Be sure to update environmentname to the WP Engine unique name of your environment (i.e. environmentname.wpengine.com)

git remote add production [email protected]:production/environmentname.git


NEXT STEP: Learn how to add your SSH key to an environment for use with GitPush

Still need help? Contact support!

We offer support 24 hours a day, 7 days a week, 365 days a year. Log in to your account to get expert one-on-one help.

The best in WordPress hosting.

See why more customers prefer WP Engine over the competition.