Key Takeaways

  • SSH Key Management is crucial for GitPush on WP Engine. Securely add SSH keys to the User Portal to enable GitPush for secure code deployment from local machines.

  • Generate SSH keys using Terminal or PuTTY. Follow specific steps to generate key pairs for secure authentication between local and remote repositories.

  • Create an SSH Config file for smooth connections. Configure the SSH file to specify which key to use when connecting to different server hostnames, preventing connection issues.

  • Test SSH Config to ensure proper setup. Run a command to verify the SSH configuration for Git access, confirming successful configuration.

In this article we will explain how to create a config file on your local machine to manage multiple SSH keys with GitPush on WP Engine.

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

Tags: