{"id":100723,"date":"2020-03-20T10:44:39","date_gmt":"2020-03-20T15:44:39","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=support&#038;p=100723"},"modified":"2025-08-04T07:43:32","modified_gmt":"2025-08-04T13:43:32","slug":"git","status":"publish","type":"support","link":"https:\/\/wpengine.com\/support\/git\/","title":{"rendered":"Git Version Control System"},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n\n\n<a name=\"generatekey\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Generate SSH Key<\/h2>\n\n\n\n<p>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&nbsp; using public and private keys to create an encrypted connection between the local machine and a remote Git repository on WP Engine.<\/p>\n\n\n\n<p>If an SSH Key does not already exist, use the steps below to generate a public\/private key pair:<\/p>\n\n\n\n<p><a href=\"#sshkeyterminal\">Option A: Generate Key Pair in Terminal<\/a><br><a href=\"#sshkeyputty\">Option B: Generate Key Pair with PuTTY<\/a><\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>For additional assistance generating SSH keys, see GitHub&#8217;s &#8220;<a href=\"https:\/\/help.github.com\/en\/github\/authenticating-to-github\/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent\" target=\"_blank\" rel=\"noreferrer noopener\">Generating a new SSH key<\/a>&#8221; article.<\/p>\n<\/div><\/div>\n\n\n\n<a name=\"sshkeyterminal\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Option A: Generate Key Pair in Terminal<\/h3>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open a Terminal window\n<ol class=\"wp-block-list\">\n<li><em>Mac<\/em>: Use the Spotlight utility and type \u201cTerminal\u201d<\/li>\n\n\n\n<li><em>Windows<\/em>: Use Git Bash <\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Use <em>ssh-keygen<\/em> to generate a new key as shown below. Be sure to replace <code><em>your_email@example.com<\/em><\/code> with the specific email address.\n<ul class=\"wp-block-list\">\n<li><code>ssh-keygen -t ed25519 -C \"<em>your_email@example.com<\/em>\" -f ~\/.ssh\/wpegitkey<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Leave the passphrase blank by hitting <em>enter<\/em> or <em>return<\/em> again, without typing anything.\n<ul class=\"wp-block-list\">\n<li>If a password is needed, this may be set. However WP Engine support cannot help it be recovered if lost.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Press <em>enter<\/em> or <em>return<\/em> again to confirm the password entry<\/li>\n\n\n\n<li>Doing this will generate a public\/private key pair<\/li>\n\n\n\n<li>Print and copy the text of the new public key file, called <code>wpegitkey.pub<\/code>\n<ul class=\"wp-block-list\">\n<li><code>cat ~\/.ssh\/wpegitkey.pub | pbcopy<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Use this output when <a href=\"https:\/\/wpengine.com\/support\/git\/#Add_SSH_Key_to_User_Portal\">adding the key to the <i>GitPush<\/i> page in the User Portal<\/a>.<\/li>\n\n\n\n<li>Key content will begin with <code>ssh-ed25519<\/code> and end with the email address used in the keygen command previously.<\/li>\n<\/ol>\n\n\n\n<a name=\"addkey\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Option B: Generate Key Pair with PuTTY<\/h3>\n\n\n\n<p>If&nbsp;the PuTTY program on Windows is in use, this requires that the PuTTYgen utility also be installed.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>When the <a href=\"https:\/\/www.putty.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">PuTTY program<\/a>, also install the <a href=\"https:\/\/www.puttygen.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">PuTTYgen utility<\/a><\/li>\n\n\n\n<li>Open the PuTTYgen utility to generate an SSH key<\/li>\n\n\n\n<li>When asked which type of key to generate, select <strong>ED25519<\/strong><\/li>\n\n\n\n<li>Click the <strong>Generate<\/strong> button to create a public and private key pair<\/li>\n\n\n\n<li><strong>Save<\/strong> both the <em>public key<\/em> and the <em>private key<\/em> locally and take note of where the files will reside on the computer<\/li>\n<\/ol>\n\n\n\n<p>This key will be needed when entering the <a href=\"https:\/\/wpengine.com\/support\/git\/#Add_SSH_Key_to_User_Portal\">public key into the WP Engine User Portal<\/a> later on. We recommend copying the key from the top of the window in PuTTY.<\/p>\n\n\n\n<a name=\"sshconfig\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Create SSH Config<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>On the local machine, first navigate to the&nbsp;<code>.ssh<\/code>&nbsp;directory.\n<ul class=\"wp-block-list\">\n<li>MacOS \u2013 Open Terminal and type:\n<ul class=\"wp-block-list\">\n<li><code>cd ~\/.ssh\/<\/code> <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Windows \u2013 Use Git Bash and navigate to:\n<ul class=\"wp-block-list\">\n<li><code>\/c\/Users\/<strong>[youruser]<\/strong>\/.ssh\/<\/code>  <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Create the config file by running:\n<ul class=\"wp-block-list\">\n<li><code>touch config<\/code> <\/li>\n\n\n\n<li>If they file already exists, proceed to the next step.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Open the new config file, below is an example using nano, but any editor would work:\n<ul class=\"wp-block-list\">\n<li><code>nano config<\/code> <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Once open, use the arrow keys to ensure the cursor is at the very bottom of the file<\/li>\n\n\n\n<li>Paste the following contents:\n<ul class=\"wp-block-list\">\n<li><code>Host git.wpengine.com<\/code><br><code>&nbsp; &nbsp;User git<\/code><br><code>&nbsp; &nbsp;Hostname git.wpengine.com<\/code><br><code>&nbsp; &nbsp;PreferredAuthentications publickey<\/code><br><code>&nbsp; &nbsp;IdentityFile&nbsp;<strong>~\/.ssh\/wpegitkey<\/strong><\/code><br><code>&nbsp; &nbsp;IdentitiesOnly yes<\/code> <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Then save and exit. For nano:\n<ul class=\"wp-block-list\">\n<li>Hold <code>ctrl<\/code> button then press <code>x<\/code> <\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>If a different key file than what <a href=\"https:\/\/wpengine.com\/support\/git\/#Generate_SSH_Key\">was generated previously<\/a>, be sure to update <code>~\/.ssh\/wpegitkey<\/code> to the desired private key file path.<\/p>\n\n\n\n<p>If&nbsp; SSH Gateway and Git are used together, <a href=\"https:\/\/wpengine.com\/support\/ssh-keys-for-shell-access\/#SSH_Config_File\">additional SSH Config contents must be added for SSH Gateway<\/a>.<\/p>\n\n\n\n<a name=\"addkey\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Add SSH Key to User Portal<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>If a key still needs to be generated, <a href=\"https:\/\/wpengine.com\/support\/git\/#Generate_SSH_Key\">review the previous step here<\/a>. 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.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Navigate to the <a href=\"https:\/\/my.wpengine.com\/sites\" target=\"_blank\" rel=\"noreferrer noopener\">Sites page<\/a> of the User Portal.<\/li>\n\n\n\n<li>Click on the <strong>environment name<\/strong> for the environment you want to update with a Git SSH key.<\/li>\n\n\n\n<li>Then select <strong>GitPush<\/strong> in the left-hand navigation (You may have to expand the <strong>Advanced<\/strong> dropdown section)<br><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"408\" class=\"wp-image-126906\" style=\"width: 700px;\" src=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-page.png\" alt=\"\" srcset=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-page.png 1840w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-page-300x175.png 300w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-page-1024x597.png 1024w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-page-768x448.png 768w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-page-1536x896.png 1536w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-page-1500x875.png 1500w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/li>\n\n\n\n<li>Fill in a <strong>Developer name<\/strong>\n<ul class=\"wp-block-list\">\n<li>If a name that is already in use, it will receive an error and will be prompted to choose another name<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Paste the contents of the <strong>public key<\/strong> in the <em>SSH public key <\/em>field\n<ul class=\"wp-block-list\">\n<li>This is the key generated in the previous step <a href=\"https:\/\/wpengine.com\/support\/git\/#Generate_SSH_Key\">Generate SSH Key<\/a><\/li>\n\n\n\n<li>Ensure there are no extra spaces or line breaks before or after the key<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click <strong>Add Developer<\/strong><\/li>\n<\/ol>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>If an error is received, please ensure that it is copied directly from the <code>wpegitkey.pub<\/code> file that was created when following the <a href=\"https:\/\/wpengine.com\/support\/git\/#Generate_SSH_Key\">Generating SSH Keys<\/a> instructions. To view the file contents again run <code>cat ~\/.ssh\/wpegitkey.pub<\/code> .<\/p>\n<\/div><\/div>\n\n\n\n<a name=\"Add_Existing_Git_User_to_Another_Environment\"><\/a>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Add Existing GitPush SSH Key to Another Environment<\/h3>\n\n\n\n<p>Be sure to add the public key to <strong>all<\/strong> 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.<\/p>\n\n\n\n<p>The following prompt&nbsp; may be seen when reusing SSH keys, and can be accepted to add the same key under a different name.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SSH key in use.\nThis SSH public key is used by <em>someuser-somesite<\/em>.\nWould you like to add this user's key to your install?<\/pre>\n\n\n\n<a name=\"Remove_Git_User\"><\/a>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Remove GitPush SSH Key<\/h3>\n\n\n\n<p>If the GitPush SSH key needs to be removed from an environment, follow these steps to delete a key.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to the <a href=\"https:\/\/my.wpengine.com\/sites\" target=\"_blank\" rel=\"noreferrer noopener\">Sites page<\/a> in the User Portal.<\/li>\n\n\n\n<li>Click on the environment name for the environment that you&#8217;re working with.<\/li>\n\n\n\n<li>Select&nbsp;<strong>GitPush<\/strong> from the secondary left menu. (You may have to expand the <strong>Advanced<\/strong> dropdown section).<br><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"229\" class=\"wp-image-126915\" style=\"width: 300px;\" src=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-menu-link.png\" alt=\"\" srcset=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-menu-link.png 805w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-menu-link-300x229.png 300w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/gitpush-menu-link-768x586.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/li>\n\n\n\n<li>Scroll down to the&nbsp;<strong>Developers list<\/strong> section.<\/li>\n\n\n\n<li>Click&nbsp;<strong>Remove<\/strong>&nbsp;next to the developer&#8217;s SSH key to revoke access.<br><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"195\" class=\"wp-image-126908\" style=\"width: 700px;\" src=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/remove-git-developer-key.png\" alt=\"\" srcset=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/remove-git-developer-key.png 1835w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/remove-git-developer-key-300x84.png 300w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/remove-git-developer-key-1024x285.png 1024w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/remove-git-developer-key-768x214.png 768w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/remove-git-developer-key-1536x428.png 1536w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2020\/03\/remove-git-developer-key-1500x418.png 1500w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/li>\n<\/ol>\n\n\n\n<p>If an environment name is seen that <em>does not<\/em> match an environment, keep in mind that the developer keys are often created with the name of the <em>original<\/em> 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 <strong>does not<\/strong> grant the owners of the referenced environment any unauthorized access to the account, nor does it grant any unauthorized access to the local machine.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Test SSH Config<\/h2>\n\n\n\n<p>Now that&nbsp;an SSH key has been created, then added to WP Engine and configured in an SSH config file, let\u2019s make sure the configuration is functioning.<\/p>\n\n\n\n<p>Run the following command in a terminal:<\/p>\n\n\n\n<p><code>ssh git@git.wpengine.com info<\/code><\/p>\n\n\n\n<p>Output similar to the following will be seen if the SSH Config file is successfully configured for Git (line numbers and version numbers will vary):<\/p>\n\n\n\n<p><code>ssh git@git.wpengine.com info<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hello user-localtesting\nR W    localtesting\nPlease see http:\/\/git.wpengine.com for more help<\/code><\/pre>\n\n\n\n<p>In our example above, the connection was successful. The result shows the information for the environment that can be connected to via ssh. This shows that the SSH config was correctly set up.<\/p>\n\n\n\n<p>If the connection was <em>unsuccessful<\/em>, run&nbsp;<code>ssh -v git@git.wpengine.com info<\/code> then read this output carefully and adjust the local config file settings accordingly. The <code>-v<\/code> or verbose option is a great place to start when troubleshooting SSH connection issues.<\/p>\n\n\n\n<p>The system will display line numbers in the output. These can help narrow down the source of issues by displaying which lines are or are not being used for the ssh connection.<\/p>\n\n\n\n<a name=\"downloadcontent\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Copy Content Locally<\/h2>\n\n\n\n<p>The next step is to download a copy of the site\u2019s content to a local machine so a remote repository can be created.<\/p>\n\n\n\n<p>If there already is a repository for the application\u2019s code, it will only need to be <a href=\"https:\/\/wpengine.com\/support\/git\/#Add_Git_Remotes\">added to the Git \u2018remote\u2019 end points<\/a> before <a href=\"https:\/\/wpengine.com\/support\/git\/#Git_Push_Deploy\">performing a GitPush<\/a>. Skip to <a href=\"https:\/\/wpengine.com\/support\/git\/#Add_gitignore\">adding the gitignore file<\/a> if this is the case as it is not required to add a repo from a backup.<\/p>\n\n\n\n<p>If a local copy does not exist, it is recommended to download a backup point from the User Portal to accomplish this step.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in to the <a href=\"https:\/\/my.wpengine.com\/sites\/\">User Portal<\/a><\/li>\n\n\n\n<li>Select the environment name that is connecting to Git<\/li>\n\n\n\n<li>Click <strong>Backup points<\/strong> in the left navigation (You may have to expand the <strong>Manage<\/strong> dropdown section)<\/li>\n\n\n\n<li>Select a backup to use as a starting point for the local repository\n<ul class=\"wp-block-list\">\n<li>If a more current backup is needed first, <a href=\"https:\/\/wpengine.com\/support\/restore\/#Make_a_Backup_Checkpoint\">review the steps here<\/a>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click <strong>Prepare Zip<\/strong><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"481\" src=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/prepare-zip-1024x481.png\" alt=\"Screenshot of an environment's Backups page in the WP Engine User Portal showing where to Prepare ZIP for a backup\" class=\"wp-image-125260\" srcset=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/prepare-zip-1024x481.png 1024w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/prepare-zip-300x141.png 300w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/prepare-zip-768x361.png 768w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/prepare-zip-1536x722.png 1536w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/prepare-zip-1500x705.png 1500w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/prepare-zip.png 1672w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li>An email alerting that the backup zip file is ready for download will be sent.<\/li>\n\n\n\n<li>Click <strong>Download<\/strong> <strong>ZIP<\/strong><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"481\" src=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/download-zip-1024x481.png\" alt=\"Screenshot of an environment's Backups page in the WP Engine User Portal showing where to Download ZIP for a backup\" class=\"wp-image-125259\" srcset=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/download-zip-1024x481.png 1024w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/download-zip-300x141.png 300w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/download-zip-768x361.png 768w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/download-zip-1536x722.png 1536w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/download-zip-1500x705.png 1500w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2024\/07\/download-zip.png 1672w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ol start=\"8\" class=\"wp-block-list\">\n<li>Click the download icon to select where to save the file. We suggest saving it to the folder on the local machine where it will be managing the Git repository.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"372\" src=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2022\/05\/git-download-zip-1024x372.png\" alt=\"\" class=\"wp-image-123060\" srcset=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2022\/05\/git-download-zip-1024x372.png 1024w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2022\/05\/git-download-zip-300x109.png 300w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2022\/05\/git-download-zip-768x279.png 768w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2022\/05\/git-download-zip-1536x557.png 1536w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2022\/05\/git-download-zip-1500x544.png 1500w, https:\/\/wpengine.com\/support\/wp-content\/uploads\/2022\/05\/git-download-zip.png 1797w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ol start=\"9\" class=\"wp-block-list\">\n<li><strong>Unzip<\/strong> the backup archive locally<\/li>\n<\/ol>\n\n\n\n<a name=\"gitignore\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Add .gitignore<\/h2>\n\n\n\n<p>The next step is to configure a <code>.gitignore<\/code> file on the local machine, which will define which files and folders should never be edited and pushed via Git. Below we have provided a template for the <code>.gitignore<\/code> file.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Download the starter <strong><a href=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2022\/08\/recommended-gitignore.txt\" target=\"_blank\" rel=\"noreferrer noopener\">WP Engine specific .gitignore template<\/a><\/strong>.<\/li>\n\n\n\n<li>Add any other files that should be ignored.<\/li>\n\n\n\n<li>Move the <code>.gitignore<\/code> file into the folder on the local machine where it will be managing the Git repository.\n<ul class=\"wp-block-list\">\n<li>Be sure to place the <code>.gitignore<\/code> file in the <strong>root directory<\/strong> of the <em>local<\/em> <em>copy<\/em> of the website.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<a name=\"version\"><\/a>\n\n\n\n<p>We suggest only tracking the minimal amount of files if possible. This helps reduce issues down the line. For example, if only working on a theme folder, the <code>.gitignore<\/code> file should exclude everything but that folder. Feel free to add any of other site-based exclusions as needed to the suggested starter template above.<br> <br>The WP Engine specific template above ignores WordPress<sup>\u00ae<\/sup> core files.<sup><a href=\"#legal-disclaimer\">1<\/a><\/sup> WP Engine will automatically keep WordPress core files up-to-date so versioning core files is not necessary. Check here for more details on our <a href=\"https:\/\/wpengine.com\/support\/wordpress-updates\/\">Auto WordPress Updates<\/a>.<\/p>\n\n\n\n<a name=\"spm\"><\/a>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Customize .gitignore for Smart Plugin Manager<\/h3>\n\n\n\n<p>When utilizing <a href=\"https:\/\/wpengine.com\/support\/smart-plugin-manager\/\">Smart Plugin Manager<\/a> and Git on a website, a more specific .gitignore should be used. You can add the following lines to your .gitignore file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># smart plugin manager specific \nwp-content\/plugins\/*\nwp-content\/.logs\/\nautoupdater_maintenance_mode_enabled.tmp<\/code><\/pre>\n\n\n\n<p>SPM automatically keeps plugins up to date so there is no need to push plugin changes via Git. This means that the entire plugin directory can be excluded as shown in the additional lines suggested above. If SPM has been configured not to manage a particular plugin, the gitignore file can be modified to re-include any plugin not managed with SPM, by adding the following to the bottom of the <code># smart plugin manager specific<\/code> section:<\/p>\n\n\n\n<p><code>!wp-content\/plugins\/<em>your-plugin-name<\/em>\/<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Disallowed Files and Types<\/h3>\n\n\n\n<p>There are certain files and types of files that are not allowed to be versioned using GitPush. Versioning large media files is not an inefficient way to use source control, as most of these files are binary, so tracking the differences between commits is difficult. . In some cases, with these known large file types, it\u2019s best to use a <a href=\"https:\/\/wpengine.com\/support\/how-does-a-cdn-work\/\">CDN<\/a>, and use <a href=\"https:\/\/wpengine.com\/support\/sftp\/\">SFTP<\/a> access to upload these files to an account.<\/p>\n\n\n\n<p>In order to keep applications running smoothly, WP Engine doesn\u2019t allow files that may affect the core functioning of the WordPress site. This includes files like <code>object-cache.php<\/code>, <code>wp-config.php<\/code>, and a number of compressed and executable file types. To prevent errors, these files should always be in the .gitignore file and are added by default to both .gitignore examples above.<\/p>\n\n\n\n<p>Below is the full list of disallowed files and types that cannot be pushed with GitPush.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wp-config\\.php<br>_wpeprivate<br>wp-content\\\/uploads<br>wp-content\\\/blogs\\.dir<br>wp-content\\\/upgrade<br>wp-content\\\/object-cache\\.php<br>wp-content\\\/mysql\\.sql<br>wp-content\\\/mu-plugins\\\/mu-plugin\\.php<br>wp-content\\\/mu-plugins\\\/slt-force-strong-passwords\\.php<br>wp-content\\\/mu-plugins\\\/wpengine-common<br>wp-content\\\/mu-plugins\\\/limit-login-attempts<br>\\.hqx$<br>\\.bin$<br>\\.exe$<br>\\.dll$<br>\\.deb$<br>\\.dmg$<br>\\.iso$<br>\\.img$<br>\\.msi$<br>\\.msp$<br>\\.msm$<br>\\.mid$<br>\\.midi$<br>\\.kar$<br>\\.mp3$<br>\\.ogg$<br>\\.m4a$<br>\\.ra$<br>\\.3gpp$<br>\\.3gp$<br>\\.mp4$<br>\\.mpeg$<br>\\.mpg$<br>\\.mov$<br>\\.webm$<br>\\.flv$<br>\\.m4v$<br>\\.mng$<br>\\.asx$<br>\\.asf$<br>\\.wmv$<br>\\.avi$<\/pre>\n\n\n\n<p>In addition, it\u2019s <strong>never<\/strong> secure to store sensitive information in source control such as passwords and\/or API keys.<\/p>\n\n\n\n<a name=\"confirmaccess\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Confirm Git Access<\/h2>\n\n\n\n<p>If it has been at least 10 minutes since adding aSSH public key to the User Portal, GitPush access can be tested for the environment.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Copy the command below into a Terminal, Git Bash, or PuTTY window:\n<ul class=\"wp-block-list\">\n<li><code>ssh git@git.wpengine.com info<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>If this is a new connection to Git on WP Engine , a prompt may be shown to verify host authenticity before connecting, like this:<\/li>\n<\/ol>\n\n\n\n<p><code>ssh git@git.wpengine.com info<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">The authenticity of host 'git.wpengine.com (&lt;no hostip for proxy command&gt;)' can't be established.<br>ECDSA key fingerprint is SHA256:Jgp8bPftGbM0rzQaeA7KTBrZa1UfEN1nqQMLIwu5i18.<br>Are you sure you want to continue connecting (yes\/no)?<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>WP Engine&#8217;s host fingerprints are:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>MD5:<\/strong> 06:f9:2f:53:3a:10:cd:56:4a:e7:eb:5d:1d:ec:ae:38 (ED25519)<br><strong>SHA256:<\/strong> wWaZBOIwBSY7fLeLdw1PX3p6IL4m+aGU\/IXprWH9CfY (ED25519)<br><br><strong>MD5:<\/strong> 19:17:ee:d2:1d:8d:c9:3e:dc:3e:0d:21:a7:c6:52:fc (RSA)<br><strong>SHA256:<\/strong> NpJNYnQBPCOzwYKJzPtwweDdW5\/RBY7Kn4hwH4yCEH4 (RSA)<br><br><strong>MD5:<\/strong> 0c:4b:07:92:dd:e0:be:50:90:7d:0d:c3:30:56:fa:9a (ECDSA)<br><strong>SHA256:<\/strong> Jgp8bPftGbM0rzQaeA7KTBrZa1UfEN1nqQMLIwu5i18 (ECDSA)<\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>If the host fingerprint matches the above, type <strong><i>yes<\/i><\/strong> to continue connecting<\/li>\n\n\n\n<li>A message will be received indicating <code>git.wpengine.com<\/code> was added to the known hosts\n<ul class=\"wp-block-list\">\n<li><i>This does not indicate a successful connection! It simply means the local machine will remember that git.wpengine.com is an accepted host with a valid fingerprint.<\/i><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">Warning: Permanently added 'git.wpengine.com,' (ED25519) to the list of known hosts.<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>If the Key is Recognized<\/strong><\/h4>\n\n\n\n<p>If the key is recognized by the Git service on WP Engine, a list of environment names that can be accessed will be displayed.<\/p>\n\n\n\n<p><code>$ ssh git@git.wpengine.com info<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">hello developer-name\nR W environmentname\nPlease see http:\/\/git.wpengine.com for more help<\/pre>\n\n\n\n<p>If a public key was added to Production, Staging, and Development environments within a Site, a unique environment name will be listed for all as <code>environmentname<\/code> <strong>regardless<\/strong> of their Production\/Staging\/Development status in the User Portal.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>If the Key is <em>Not<\/em> Recognized<\/strong><\/h4>\n\n\n\n<p>If the key is <em>not<\/em> recognized by the Git service on WP Engine, this error will be shown:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>git@git.wpengine.com: Permission denied (publickey).<\/code><\/pre>\n\n\n\n<p>This error indicates that the WP Engine Git service does not recognize the key. Either:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Enough time has not passed to allow the key to be fully added (up to 45 minutes)\n<ul class=\"wp-block-list\">\n<li>Try waiting longer, then attempt to connect again<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Or, the incorrect key may be in use for the connection\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/wpengine.com\/support\/managing-multiple-ssh-keys-git\/\">Create an SSH config file<\/a> to ensure the computer presents the correct key to git.wpengine.com<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<a name=\"firstcommit\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">First Git Commit<\/h2>\n\n\n\n<p>Start by creating a local Git repository if the site hasn\u2019t been used as a Git repository before. This can be done by using the <code>git init<\/code> command.<\/p>\n\n\n\n<p><code>cd ~<strong>\/path\/to\/localrepo<\/strong><\/code><\/p>\n\n\n\n<p><code>git init .<\/code><\/p>\n\n\n\n<p>Now that the folder is set up as a Git repository, it\u2019s time for the first commit. This commit will add all modified and new files (other than those in the <code>.gitignore<\/code> file) to Git for them to be tracked. This is a new copy of the website in theGit repository, so most files will be \u201cnew\u201d to git.<\/p>\n\n\n\n<p><code>git add . --all<\/code><\/p>\n\n\n\n<p><code>git commit -m \"First Commit\"<\/code><\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>At this point, <em>nothing<\/em> has changed on the front-end of the WordPress website. The next step,&nbsp;&#8220;Add Git Remote Repository&#8221;,&nbsp;needs to be completed before using the GitPush command to deploy files.<\/p>\n<\/div><\/div>\n\n\n\n<a name=\"Add_Git_Remotes\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Add Git Remote Repository<\/h2>\n\n\n\n<p>The next step is to map the local repository to the remote repository where it will deploy file changes on WP Engine. If a key has been added to production, staging, and development environments within the site in the first step, a remote will need to be added for each of these environments. It will be a one-to-one relationship between remote repository and environment.<\/p>\n\n\n\n<p>In the below commands, replace <strong><code>prodenvname<\/code><\/strong>, <strong><code>stageenvname<\/code><\/strong>, and <strong><code>devenvname<\/code><\/strong> with the unique User Portal names of each environment.<\/p>\n\n\n\n<p>First, navigate to the local Git directory that was created:<\/p>\n\n\n\n<p><code>cd ~<em><strong>\/path\/to\/localcopy<\/strong><\/em><\/code><\/p>\n\n\n\n<p>Then add the remotes for each environment:<\/p>\n\n\n\n<p><code>git remote add production git@git.wpengine.com:<em><strong>prodenvname<\/strong><\/em>.git<\/code><\/p>\n\n\n\n<p><code>git remote add staging git@git.wpengine.com:<em><strong>stageenvname<\/strong><\/em>.git<\/code><\/p>\n\n\n\n<p><code>git remote add development git@git.wpengine.com:<em><strong>evenvname<\/strong><\/em>.git<\/code><\/p>\n\n\n\n<p>The remotes \u201cproduction,\u201d \u201cstaging,\u201d and \u201cdevelopment\u201d&nbsp; can be renamed by running <code>git remote rename old_name new_name<\/code>. WP Engine suggests naming them according to their role in the site to help with repository management that scales easier.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<p><code>git remote add <strong>mysitename<\/strong><em>-production<\/em> git@git.wpengine.com:<strong>myprodenvname<\/strong>.git<\/code><\/p>\n\n\n\n<p>To confirm the remotes were successfully added, use the following <code>git remote<\/code> command:<\/p>\n\n\n\n<p><code>git remote -v<\/code><\/p>\n\n\n\n<p>This will list all the remotes that were successfully added. Now a GitPush command can be done to deploy code changes.<br><a name=\"gitpush\"><\/a><\/p>\n\n\n\n<a name=\"Git_Push_Deploy\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">GitPush Deploy<\/h2>\n\n\n\n<p>Now it\u2019s time to deploy using the GitPush command. After a local change has been made and staged (EX: using <code>git add<\/code> and <code>git commit<\/code>), use a Terminal, Git Bash, or PuTTY window and move to the folder where the local git repository was initialized:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Type <em>git push<\/em><\/li>\n\n\n\n<li>Type the <em>name of the remote<\/em> that will be pushed<\/li>\n\n\n\n<li>Type the name of the local branch to push<\/li>\n\n\n\n<li>It is recommend to add the <code>-v<\/code> flag to show a verbose output, which can be helpful if there are any errors.<\/li>\n<\/ul>\n\n\n\n<p>EX: <code>git push -v <em>remote-name<\/em> <em>branch-name<\/em><\/code><\/p>\n\n\n\n<p>To push the production main branch, for example, would look like this:<\/p>\n\n\n\n<p><code>git push -v production main<\/code><\/p>\n\n\n\n<p>The above command will push the local \u201cmain\u201d branch to the remote endpoint named \u201cproduction.\u201d If the remote endpoint is named something else, be sure to replace \u201cproduction\u201d with that name instead (EX: <code>git push -v <em>mysitename-production<\/em> <em>main<\/em><\/code>).<\/p>\n\n\n\n<p>Pay attention to the GitPush output, as it will indicate whether the push was successful or if it encountered any errors.<\/p>\n\n\n\n<p>If more help is needed, please contact our Support team via the <a href=\"https:\/\/my.wpengine.com\/support\/\">User Portal<\/a> and provide the full output of the GitPush.<\/p>\n\n\n\n<a name=\"Remove_Files_with_Git_push\"><\/a>\n\n\n\n<h3 class=\"wp-block-heading\">Remove Files with GitPush<\/h3>\n\n\n\n<p>The deployment end of the GitPush process will only <strong>remove<\/strong> files from the application that have also been removed from the repository. For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add a file to the application, commit and push it to WP Engine,<\/li>\n\n\n\n<li>Later this file is no longer needed,<\/li>\n\n\n\n<li>Remove this file from the application, commit and push back to WP Engine,<\/li>\n\n\n\n<li>Now the file is removed from the live application.<\/li>\n<\/ul>\n\n\n\n<p>If a file never existed in the repository it will not be removed from the application upon pushing.<\/p>\n\n\n\n<p>Additionally, we recommend including the flag to remove empty directories for additional cleanup when removing files via GitPush: <code>remove-empty-dirs<\/code><\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<p><code>git push -v -o remove-empty-dirs production main<\/code><\/p>\n\n\n\n<a name=\"Git_Push_for_AWS\"><\/a>\n\n\n\n<h3 class=\"wp-block-heading\">GitPush for AWS<\/h3>\n\n\n\n<p>Git pushing to a website hosted on AWS will require the web servers to sync, which could cause issues. Pushing with the flag <code>--push-option=blue-green-deploy<\/code> can help resolve these sync issues.<\/p>\n\n\n\n<p>While a blue-green deployment will not make the process faster, it will restore to a separate directory on the server and then move it into place. Be aware that due to this, the site will occupy 2x the disk space during the process.<\/p>\n\n\n\n<p><code>git push --push-option=blue-green-deploy -v production my_branch<\/code><\/p>\n\n\n\n<p>The blue-green deploy will not work on Google or Azure hosted websites.<\/p>\n\n\n\n<a name=\"support\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Git Support Commands<\/h2>\n\n\n\n<p>Should you need to reach <a href=\"https:\/\/wpengine.com\/support-contact\/\">support<\/a> with a GitPush question or issue, below are some helpful commands to execute and provide output to speed up the support process, and get the issue addressed efficiently.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-table table table-striped is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th>Requested Output<\/th><th>Reasoning<\/th><\/tr><\/thead><tbody><tr><td><code>ssh-keygen -E ed25519 -lf ~<strong>\/path\/to\/keyfile.pub<\/strong><\/code><\/td><td>Outputs the SSH public key. The example, ~\/path\/to\/keyfile.pub , should be replaced with the actual path to the SSH public key on the system that matches the SSH public key that was added to User Portal. If the fingerprint for the SSH public key matches the output, then authentication to the repository will be successful.<\/td><\/tr><tr><td><code>ssh -vv git@git.wpengine.com info<\/code><\/td><td>Provides verbose output of the SSH connection to git.wpengine.com which can be used to troubleshoot connection and authentication issues.<\/td><\/tr><tr><td><code>git remote -v<\/code><\/td><td>Provides a list of all the Git remote endpoints associated with the Git repository. This allows us to see that the endpoints have been configured correctly.<\/td><\/tr><tr><td><code>git push -v<\/code><\/td><td>Provides output and feedback during the \u2018git push\u2019 deployment. This output can be used to diagnose an issue or error with a \u2018git push\u2019 attempt.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<a name=\"info\"><\/a><a name=\"SFTP_and_Git\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">SFTP and GitPush<\/h2>\n\n\n\n<p>Do not attempt to control a file with both SFTP and Git. GitPush is a one-way versioning tool. Any changes that are made to a file system through a web interface or via SFTP will <strong>not<\/strong> propagate back into Git. Also there is no warning if code is pushed up via Git that is older than code that\u2019s presently on the installation. We recommend setting up a local dev environment and making all code changes there and pushing those changes to an app through Git. Read more about setting up a local development environment <a href=\"http:\/\/wp.smashingmagazine.com\/2011\/09\/28\/developing-wordpress-locally-with-mamp\/\">here<\/a>. If it is needed to preserve changes made to versioned files, download the files via SFTP and commit them to the local repository.<\/p>\n\n\n\n<p>If there is code on the site that resides outside of the Git repository, it\u2019s best to avoid updates using SFTP and file editors in the WordPress admin unless necessary. If this is found necessary to use, be sure to avoid making changes to any code that\u2019s versioned via GitPush, as it will be reverted to the versioned content on the next push.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Remove Files From Git<\/h2>\n\n\n\n<p>If it is decided to no longer version WordPress files via GitPush, the files will need to be removed from tracking locally with <code>git rm --cached<\/code>. This will remove them from the repository, but leave them in place in the working directory.<\/p>\n\n\n\n<p>Once done, add a commit with this change, <a href=\"https:\/\/wpengine.com\/support\/resetting-your-git-push-to-deploy-repository\/\">reset the GitPush point repository<\/a>, then push the commit&nbsp; for the site.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Database Versioning<\/h2>\n\n\n\n<p>Pushing a database via Git does not automatically import the database file to a website.<\/p>\n\n\n\n<p>The ideal method is to perform a database export locally, add the SQL file to your repository, then commit and push the change. Once the database file is on a WP Engine server, import the file to your WP Engine website using using <a href=\"https:\/\/wpengine.com\/support\/ssh-gateway\/\">SSH Gateway<\/a>.<\/p>\n\n\n\n<p>The database can also be connected to remotely. If a remote database management system is in use, the database can be imported from the local machine directly to WP Engine. Please see <a href=\"https:\/\/wpengine.com\/support\/setting-remote-database-access\/\">Setting up Remote Database Access<\/a> for more information.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Backups and Git<\/h2>\n\n\n\n<p>When a <a href=\"https:\/\/wpengine.com\/support\/restore\/\">restore<\/a> is made, the Git repository does <strong>not<\/strong> receive an update. The backup will need to be downloaded and merged with the local files, then committed and pushed to the configured remote repository to update the WordPress site.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Submodules<\/h2>\n\n\n\n<p>Submodules can work with WP Engine GitPush, so long as the submodule can be cloned without requiring a specific SSH key or username\/password combination and responds to the \u2018git\u2019 protocol. It wouldn\u2019t be possible to say, clone a private GitHub repository from the account \u2013 it has to be publicly accessible.<\/p>\n\n\n\n<p>To set up the submodule, the external repository needs to use the HTTPS URL and not the GitHub SSH URL. For example:<\/p>\n\n\n\n<p><code>[submodule \"SUBMODULE\"]<br> path = wp-content\/plugins\/<strong>SUBMODULE<\/strong><br> url = https:\/\/github.com\/<strong>USER<\/strong>\/<strong>REPO<\/strong>.git<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Git Clone<\/h2>\n\n\n\n<p>In order to clone a repo:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The repo must exist<\/li>\n\n\n\n<li>A commit has to have been <a href=\"#gitpush\">Git pushed to WP Engine<\/a><\/li>\n\n\n\n<li><a href=\"#addkey\">SSH keys must be added<\/a> for <em>all<\/em> users who want to connect to the repo<\/li>\n<\/ol>\n\n\n\n<p>View a list of remotes a user has access to:<\/p>\n\n\n\n<p><code><code>ssh git.wpengine.com<\/code><\/code><\/p>\n\n\n\n<p>This will give an output similar to:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ssh git.wpengine.com\n\nhello user-name\nR W environmentname.git\n\nPlease see http:\/\/git.wpengine.com for more help\nShared connection to git.wpengine.com closed.<\/pre>\n\n\n\n<p>To clone the existing repository, take the Git remote address (EX: <code>environmentname.git<\/code>) and add it to a <code>git clone<\/code> command. Be sure to replace <code><em>environmentname<\/em><\/code> with the unique WP Engine name of the environment.<\/p>\n\n\n\n<p><code>git clone git@git.wpengine.com:<strong><em>environmentname<\/em>.git<\/strong><\/code><\/p>\n\n\n\n<p>Successful output is similar to the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Cloning into '<em>environmentname<\/em>'...\nremote: Counting objects: 677, done.\nremote: Compressing objects: 100% (532\/532), done.\nremote: Total 677 (delta 129), reused 669 (delta 126)\nReceiving objects: 100% (677\/677), 14.11 MiB | 7.69 MiB\/s, done.\nResolving deltas: 100% (129\/129), done.<\/pre>\n\n\n\n<p>A git clone, by default, will create the repository directory. The repository now exists, in this example, in ~\/<em>environmentname<\/em>\/. The repo can be pushed normally after making a commit.<\/p>\n\n\n\n<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"10de4b\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>WP Engine only supports SSH-type clones and does not offer http\/https access for Git repositories.<\/p>\n<\/div><\/div>\n\n\n\n<p>WP Engine support for branches is unique in that whichever branch was <em>last pushed<\/em> is the one that gets copied to the environment on WP Engine. The previous push takes precedence, so switching branches and attempting to have those changes take precedence will not work.<\/p>\n\n\n\n<p>For more information on Git clone, such as flags, please see: <a href=\"https:\/\/www.git-scm.com\/docs\/git-clone\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.git-scm.com\/docs\/git-clone<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">GitPush Failure<\/h2>\n\n\n\n<p>If a Git push is not reaching your WP Engine environment or otherwise failing, Support may need to clear the Git cache for the environment. This is most common if you&#8217;ve recently updated the .gitignore file or have been pushing from different branches. To reset the Git files for your website reach out the <a href=\"https:\/\/my.wpengine.com\/support\" target=\"_blank\" rel=\"noreferrer noopener\">WP Engine Support<\/a> for assistance.<\/p>\n\n\n\n<p>Once Git cache has been cleared you should be able to perform the push again, however you may be required to make a new commit to trigger the Git hooks. This can be as minor as adding a new line or whitespace to a file, committing, and then pushing.<\/p>\n\n\n\n<p>Deleting the Git cache will not affect your local repository or anything outside of WP Engine&#8217;s systems, as a deletion of the git-cache directory does not create a commit and cannot affect live or local data.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p><strong>NEXT STEP: <a href=\"https:\/\/wpengine.com\/support\/resetting-your-git-push-to-deploy-repository\/\">Resetting the GitPush repository<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Git is a powerful version control management system. Learn how to connect and securely push changes from Git to WP Engine.<\/p>\n","protected":false},"featured_media":126216,"template":"","support-categories":[3,6,77],"support-tag":[4],"class_list":["post-100723","support","type-support","status-publish","has-post-thumbnail","hentry","support-categories-development","support-categories-platform","support-categories-third-party","support-tag-git"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git Version Control System - Support Center<\/title>\n<meta name=\"description\" content=\"Git is a powerful version control management system. Learn how to connect and securely push changes from Git to WP Engine.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpengine.com\/support\/git\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Version Control System - Support Center\" \/>\n<meta property=\"og:description\" content=\"Git is a powerful version control management system. Learn how to connect and securely push changes from Git to WP Engine.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/support\/git\/\" \/>\n<meta property=\"og:site_name\" content=\"Support Center\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-04T13:43:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"19 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/support\/git\/\",\"url\":\"https:\/\/wpengine.com\/support\/git\/\",\"name\":\"Git Version Control System - Support Center\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wpengine.com\/support\/git\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wpengine.com\/support\/git\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"datePublished\":\"2020-03-20T15:44:39+00:00\",\"dateModified\":\"2025-08-04T13:43:32+00:00\",\"description\":\"Git is a powerful version control management system. Learn how to connect and securely push changes from Git to WP Engine.\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/support\/git\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/support\/git\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/support\/git\/#primaryimage\",\"url\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"contentUrl\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"width\":1200,\"height\":630,\"caption\":\"WP Engine\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/support\/git\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Support Posts\",\"item\":\"https:\/\/wpengine.com\/support\/support\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git Version Control System\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/support\/#website\",\"url\":\"https:\/\/wpengine.com\/support\/\",\"name\":\"Support Center\",\"description\":\"WP Engine&#039;s Support Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git Version Control System - Support Center","description":"Git is a powerful version control management system. Learn how to connect and securely push changes from Git to WP Engine.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpengine.com\/support\/git\/","og_locale":"en_US","og_type":"article","og_title":"Git Version Control System - Support Center","og_description":"Git is a powerful version control management system. Learn how to connect and securely push changes from Git to WP Engine.","og_url":"https:\/\/wpengine.com\/support\/git\/","og_site_name":"Support Center","article_modified_time":"2025-08-04T13:43:32+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"19 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/support\/git\/","url":"https:\/\/wpengine.com\/support\/git\/","name":"Git Version Control System - Support Center","isPartOf":{"@id":"https:\/\/wpengine.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/support\/git\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/support\/git\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","datePublished":"2020-03-20T15:44:39+00:00","dateModified":"2025-08-04T13:43:32+00:00","description":"Git is a powerful version control management system. Learn how to connect and securely push changes from Git to WP Engine.","breadcrumb":{"@id":"https:\/\/wpengine.com\/support\/git\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/support\/git\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/support\/git\/#primaryimage","url":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","contentUrl":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","width":1200,"height":630,"caption":"WP Engine"},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/support\/git\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/support\/"},{"@type":"ListItem","position":2,"name":"Support Posts","item":"https:\/\/wpengine.com\/support\/support\/"},{"@type":"ListItem","position":3,"name":"Git Version Control System"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/support\/#website","url":"https:\/\/wpengine.com\/support\/","name":"Support Center","description":"WP Engine&#039;s Support Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support\/100723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/types\/support"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/media\/126216"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/media?parent=100723"}],"wp:term":[{"taxonomy":"support-categories","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support-categories?post=100723"},{"taxonomy":"support-tag","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support-tag?post=100723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}