Git Version Control System
Tags:
Key Takeaways
Git Version Control System enables secure code deployment. WP Engine’s GitPush tool facilitates code transfer from local machines to websites, enhancing development efficiency.
SSH Keys ensure encrypted connections for GitPush. Generating and adding SSH Keys to User Portal is crucial for secure GitPush usage.
Configuring SSH files prevents connection issues. Setting up SSH Config files ensures smooth communication between local machines and remote servers.
Testing SSH Config verifies successful setup. Running tests confirms proper configuration for Git operations.
Git is a version control system which allows a person to record changes to a file or set of files over time so that specific version can be reproduced later. WP Engine provides a tool called GitPush, which works with Git to allow the secure pushing of code from a local machine to a WP Engine website.
Generate SSH Key
The first step to enabling GitPush on a WP Engine site is to add an SSH Key to the User Portal. SSH Keys are key-based authentication using public and private keys to create an encrypted connection between the local machine and a remote Git repository on WP Engine.
If an SSH Key does not already exist, use the steps below to generate a public/private key pair:
Option A: Generate Key Pair in Terminal
Option B: Generate Key Pair with PuTTY
Option A: Generate Key Pair in Terminal
- Open a Terminal window
- Mac: Use the Spotlight utility and type “Terminal”
- Windows: Use Git Bash
- Use ssh-keygen to generate a new key as shown below. Be sure to replace
[email protected]with the specific email address.ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/wpegitkey
- Leave the passphrase blank by hitting enter or return again, without typing anything.
- If a password is needed, this may be set. However WP Engine support cannot help it be recovered if lost.
- Press enter or return again to confirm the password entry
- Doing this will generate a public/private key pair
- Print and copy the text of the new public key file, called
wpegitkey.pubcat ~/.ssh/wpegitkey.pub | pbcopy
- Use this output when adding the key to the GitPush page in the User Portal.
- Key content will begin with
ssh-ed25519and end with the email address used in the keygen command previously.
Option B: Generate Key Pair with PuTTY
If the PuTTY program on Windows is in use, this requires that the PuTTYgen utility also be installed.
- When the PuTTY program, also install the PuTTYgen utility
- Open the PuTTYgen utility to generate an SSH key
- When asked which type of key to generate, select ED25519
- Click the Generate button to create a public and private key pair
- Save both the public key and the private key locally and take note of where the files will reside on the computer
This key will be needed when entering the public key into the WP Engine User Portal later on. We recommend copying the key from the top of the window in PuTTY.
Create SSH Config
The SSH configuration file tells the computer which key file to use when connecting to a specific server hostname. SSH Gateway and GitPush use different hostnames on WP Engine.
Setting up an SSH config file, and telling the computer in advance which SSH key is used for a service, will prevent any possible connection issues.
- On the local machine, first navigate to the
.sshdirectory.- MacOS – Open Terminal and type:
cd ~/.ssh/
- Windows – Use Git Bash and navigate to:
/c/Users/[youruser]/.ssh/
- MacOS – Open Terminal and type:
- Create the config file by running:
touch config- If they file already exists, proceed to the next step.
- Open the new config file, below is an example using nano, but any editor would work:
nano config
- Once open, use the arrow keys to ensure the cursor is at the very bottom of the file
- Paste the following contents:
Host git.wpengine.comUser gitHostname git.wpengine.comPreferredAuthentications publickeyIdentityFile ~/.ssh/wpegitkeyIdentitiesOnly yes
- Then save and exit. For nano:
- Hold
ctrlbutton then pressx
- Hold
If a different key file than what was generated previously, be sure to update ~/.ssh/wpegitkey to the desired private key file path.
If SSH Gateway and Git are used together, additional SSH Config contents must be added for SSH Gateway.
Add SSH Key to User Portal
To securely use GitPush with a WP Engine environment, an SSH key must be added to the User Portal in the GitPush section. The key must be added to each environment independently to use GitPush.
If a key still needs to be generated, review the previous step here. A Developer name will be a label for the SSH key being added, and can be considered a name associating the local machine (aka the developer) that will be using GitPush. We recommend that a combination of environment name, first initial, and last name separated by a hyphen be used for the name. Only letters, numbers, hyphens, and underscores are allowed with a maximum 30 characters for the developer name.
- Navigate to the Sites page of the User Portal.
- Click on the environment name for the environment you want to update with a Git SSH key.
- Then select GitPush in the left-hand navigation (You may have to expand the Advanced dropdown section)

- Fill in a Developer name
- If a name that is already in use, it will receive an error and will be prompted to choose another name
- Paste the contents of the public key in the SSH public key field
- This is the key generated in the previous step Generate SSH Key
- Ensure there are no extra spaces or line breaks before or after the key
- Click Add Developer
Add Existing GitPush SSH Key to Another Environment
Be sure to add the public key to all environments individually for GitPush. Once the key has been added in WP Engine User Portal it can be added to additional environments by adding the key and same developer name to a different environment, as shown above.
The following prompt may be seen when reusing SSH keys, and can be accepted to add the same key under a different name.
SSH key in use. This SSH public key is used by someuser-somesite. Would you like to add this user's key to your install?
Remove GitPush SSH Key
If the GitPush SSH key needs to be removed from an environment, follow these steps to delete a key.
- Go to the Sites page in the User Portal.
- Click on the environment name for the environment that you’re working with.
- Select GitPush from the secondary left menu. (You may have to expand the Advanced dropdown section).

- Scroll down to the Developers list section.
- Click Remove next to the developer’s SSH key to revoke access.

If an environment name is seen that does not match an environment, keep in mind that the developer keys are often created with the name of the original environment as part of an identifier for the SSH key. Some developers may have keys that are tied to environments that are not associated with the current account. This does not grant the owners of the referenced environment any unauthorized access to the account, nor does it grant any unauthorized access to the local machine.