Reset Git Push to Deploy a New Repository

With WP Engine’s Git Push you can keep your entire website in a version control system and push changes through a method other than SFTP. However, you might come to the point where you find that you need to delete your entire current repository and start anew. Resetting your Git Push repository on WP Engine is actually a very simple process.

NOTE

If you do this, there is NO “undo“. Support cannot restore your Git repository to a previous state. You must be absolutely sure that deleting your entire repository is what you really want to do before continuing.


Initiate New Repository Locally

You should already be fairly familiar with how Git works before getting to this point. If you’re still new to Git and aren’t as familiar with initiating a new repository, you can reference the Getting Started page for Git Push to Deploy.

Here is the most important portion:

cd ~/wordpress/my_wordpress_app
git init .
git add . --all
git commit -m "initial commit"

To put a blank repository into place instead of starting with previously created site data, this will not be possible as Git requires the tracking of at least one file to push content over.
Creating a blank text file with a name of your choosing (“blank_file.txt” for example) will allow you to clear out the data within the Git Push repository on our end.


Force Push New Repository

We have set up our Git Push system to allow you to set up a new repository as-needed. When you push to our servers this time tell Git to “force” the push by adding -f.

If you are pushing to production, the command might look like this:

git push -f production main

Source

You should get output that looks similar to this:


Continue Using Git Push

Now you should be able to keep using Git push exactly as before. You can make new commits and push them.

After the first push, it is no longer necessary to use -f in the push command.


NEXT STEP: Learn how to purge server caches

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 hosting for WordPress

See why more customers prefer WP Engine over the competition.