Managed WooCommerce Stores Help

Set up a Git repository for automatic deployments to your Managed WooCommerce Stores site

Using version control like GitHub for automatic deployments is a best practice. To minimize problems, make sure that your repository is configured correctly. Here are a couple of key concepts to keep in mind for automatic deployments from version control.

Warning: Be sure your repository matches your production environment, or you could lose data.

Mirror your production environment

At deployment time, everything on the destination site is changed to match what's in your Git repository. So when you first set up (or if you're upating) the repository, start by pulling a copy of your production code and pushing that code into the repository.

Note: If you've already got existing deployments, you may need to set up file exclusions before you push that copy of your code from production into your repository. See the next sections for info.

Exclude certain files from automatic deployments

There are a few kinds of files that you may need to exclude from automatic deployments:

Note: Some files are excluded by default from automatic deployments.

WordPress core files to exclude

We handle all updates to WordPress core files automatically. So, to avoid committing those core files when you deploy, add these rules to your .gitignore file:

# Ignore WordPress core files*/

Depending on how you've configured your site, there may be others you'll want to exclude as well. Be sure to check over your files and set up exclusions for anything unnecessary, such as cache and backup files.

In most scenarios where an entire site is being kept inside version control, the repository's root directory should only contain the wp-content directory.

Note: If you're using our integration system and Docker image to deploy your site from version control, many of these will be excluded from the upload for you, even if they exist inside your repository. For more information, see the next section.

Development files to exclude

Besides WordPress core files, you probably need to exclude files specific to your local development environment, as seen in this .gitignore example:

# Development environments

# Databases

# Logs

# Build files

# Compressed files

# OS files

You may need to add or remove some of these from this list. For any files that you need to have inside of your repository but don't want to deploy, you can exclude them on deployment as described in the next section.

Additional files to exclude

For files that you still need to have inside of your repository but don't want to deploy, integrations using our deployment Docker image allow you to set more exclusions. To do so, create a .pagely/pagelyignore file. This file ignores individual files or directories, relative to the repository's root, as in this example:

Note: If you're deploying from a directory that is not at the repository's root (you've defined a PAGELY_WORKING_DIR variable within your deployments), you'll need to place the .pagely directory and corresponding pagelyignore file at the root of that directory. Any file paths within the pagelyignore file are also relative to the PAGELY_WORKING_DIR path.

Default file exclusions

When using our deployment integration system, these files are excluded by default:


More info

Share this article