Skip to content
    Guide

    Deploying a theme or plugin from GitHub

    Last updated

    If you keep a custom theme or plugin in a GitHub repository, MaintainHQ can deploy it to your WordPress site for you. Every deploy is backed up, checked, and rolled back automatically if the site breaks. Gus reviews each change in the background and flags anything risky.

    You can deploy by hand with a button, or have MaintainHQ deploy whenever you push to a chosen branch, with an approval step and a rule that keeps automatic deploys away from your live site.

    Before you start

    • A GitHub account or organisation that holds the repository.
    • The site connected to MaintainHQ, with the MaintainHQ plugin version 3.10.0 or later. Older versions answer "out of date".
    • Ideally a staging site to try deploys on first.

    Open GitHub under Tools in the left-hand menu. The page is called Git & Deployments. If it says "GitHub isn’t set up on this MaintainHQ server yet", Git deploys are not available on your account yet and nothing on this page can be used.

    Connecting your GitHub account

    1. Press Connect GitHub. GitHub opens and asks you to install the MaintainHQ app.
    2. Choose the account or organisation, and which repositories MaintainHQ may use. You can pick only the ones you need.
    3. Approve. GitHub sends you back and the page says "GitHub connected". The account appears as a badge at the top.

    If you installed the app on GitHub earlier, use Link it to MaintainHQ under the Connect GitHub button instead. To give access to more repositories or another account later, press Add repositories or accounts.

    MaintainHQ only reads your repositories to deploy them. It never pushes to the branch you deploy from.

    Connecting a repository to a site

    Press Connect Repo and fill in the form:

    The Connect a repository form
    FieldWhat to enter
    GitHub accountThe account that holds the repository, if you connected more than one.
    RepositoryThe repository. If the list is empty, add repositories in the app’s settings on GitHub.
    Branch to deployThe branch deploys come from, for example main.
    SiteThe MaintainHQ site to deploy to.
    Deploy intoA theme or A plugin, plus the folder name on the site. Use letters, numbers, dots, dashes and underscores. It cannot be the MaintainHQ plugin’s folder.
    Folder in the repository (optional)If the theme or plugin is in a sub-folder, for example wp-content/themes/my-theme. Leave it empty to deploy the whole repository.

    Press connect. The message "Repository connected. Nothing has been deployed yet." confirms it. Each connection deploys into exactly one theme or plugin folder on one site; connect the repository again for another site, such as production.

    Deploying

    On the Repos tab, press Deploy on a connection. Under Branch or commit, leave the branch to deploy its latest commit, or paste a full commit ID. The box lists what will happen, then press deploy. Follow it on the Deploys tab.

    Deploy statuses
    StatusMeaning
    QueuedWaiting to start.
    PackagingDownloading the commit and packing the chosen folder.
    Backing upTaking a full site backup first, if that setting is on.
    DeployingSwapping the new version into place.
    Checking the siteMaking sure the site still works.
    LiveDeployed and working. The current version has a "Current" badge.
    Waiting for approvalA push deploy waiting for someone to press Approve.
    Rolled backThe site broke, so the previous version was put back.
    Rollback failed: check the siteThe previous version could not be restored automatically. Check the site now.
    Failed / RejectedThe deploy did not go ahead.

    Each row has a log button to read the deploy log. A waiting deploy has Approve and Reject buttons. A live deploy has Roll back, which redeploys the commit that was live before it (or, for a first deploy, restores the original folder).

    How a deploy protects your site

    1. MaintainHQ downloads the commit and keeps only the chosen folder, leaving out .git, .github and node_modules.
    2. If Full backup before every deploy is on (it is by default), a complete backup of the site is taken and the deploy waits for it.
    3. The site downloads the package, checks it arrived intact, moves the current folder aside as a snapshot and puts the new one in its place.
    4. The site loads its own home page. A server error or WordPress "critical error" puts the snapshot straight back.
    5. For the next 10 minutes a small guard watches for fatal PHP errors coming from the deployed folder and restores the snapshot by itself if one appears, even if the error takes the rest of WordPress down.
    6. MaintainHQ also checks the site from outside. If it is worse than before the deploy, it rolls back.

    Deploy settings

    Open the Settings tab, or the settings button on a connection, and choose the repository:

    • Deploy automatically when this branch is pushed: GitHub tells MaintainHQ about every push, and only the chosen branch deploys.
    • Push deploys wait for approval: a push creates the deploy, which then waits for someone to press Approve. Deploys you start by hand are approved by that click.
    • Full backup before every deploy: the deploy waits for a complete site backup. The deployed folder is always kept as a snapshot either way.
    • No automatic deploys to production: pushes never deploy to a production site. Production only changes when you press Deploy.

    The settings page also offers a standard .gitignore for WordPress projects to copy into your repository. On the Repos tab, the switch on each connection turns its deploys on or off (a paused connection shows "Paused"), and the disconnect button removes the connection.

    Gus code reviews and pull requests

    After each deploy, Gus reviews the changes in the background. The AI Reviews tab shows each review with a risk rating (Low, Medium or High Risk with a score), the issues found and suggestions. The review is advice only: it never blocks or rolls back a deploy. You can ask Gus to review a change again.

    When Gus proposes a code change to a theme that you deploy from a connected repository, it can offer the change as a pull request on GitHub instead of a fix plan. You review and merge it on GitHub as usual, and your normal deploy picks it up.

    Frequently asked questions

    Can MaintainHQ change my code on GitHub?
    MaintainHQ reads repositories to deploy them and never pushes to the branch you deploy from. The only thing it can add is a pull request, when you ask Gus to propose a code change, which you choose whether to merge.
    What happens if a deploy breaks my site?
    The previous version goes back automatically: straight away if the home page fails, within 10 minutes if a fatal error appears from the deployed code, or after the outside health check if the site is worse than before.
    Can I stop pushes going straight to my live site?
    Yes. Turn on No automatic deploys to production, and optionally Push deploys wait for approval.
    Can I deploy WordPress core or a whole site from Git?
    No. Each connection deploys one theme or one plugin folder.

    Let MaintainHQ run the routine

    Updates with automatic rollback, backups, uptime, security checks and client reports, with Gus to fix what breaks.

    Start free trial

    From £29 a month for up to 2 sites. Every plan starts with a 14-day trial.