Git sync keeps the code of your WordPress site in a private repository on GitHub, GitLab or Bitbucket: wp-content (themes, plugins, mu-plugins) and the files at the top. You work on your own computer, push to the repository, and press Pull from Git and Deploy Live on FlyNode, or let a webhook do it when you push. The site is checked after the deploy and put back by itself if it breaks.
The database and the media library never go into Git. They hold your content, orders, comments and users, and FlyNode backups protect them. A deploy never touches them.
It has its own tab, Git Sync, in the menu of your WordPress (OpenLiteSpeed) site (next to Staging and File Manager). You need the Developer role or higher.
The whole path, one time
- Get the site on FlyNode. If it lives somewhere else, move it with the Send to FlyNode plugin. See Move Your Site to FlyNode.
- Make a copy on your computer. In the Git Sync tab press Download for Local. You get one zip with
database.sqlandwp-content, made from the running site, with no plugin. In Local choose Import site and pick the zip. (You can also skip FlyNode for this step: the Send to FlyNode plugin makes the same kind of Local backup straight on your old site.) - Put the local copy in Git. In Local, open the site's folder and go into
app/public. That folder is the repository. Save the.gitignorefrom the card (button Get a .gitignore) there as.gitignore. In GitHub Desktop choose File, Add local repository for that folder, create the repository, and press Publish repository with Keep this code private ticked. - Connect it on FlyNode. Press Connect a repository. Enter the repository address, press Create key, add the public key to the repository as a deploy key (tick the write access box the card asks for), press Test connection, then Connect this repository. Nothing is changed on the site by connecting.
FlyNode uses the repository's main branch as the live branch and a branch called staging for the staging copy of the site. Create the staging branch in GitHub Desktop when you want to try changes on staging first.
Every day after that
- Change the site in Local: a theme, a plugin, a template, a setting in a file.
- In GitHub Desktop, Commit and Push origin.
- On FlyNode press Pull from Git and Deploy Staging to look at the result on the staging copy (it deploys the
stagingbranch), then Pull from Git and Deploy Live (it deploys the live branch). - If something is wrong, press Previous version.
Nothing flows back from the live site to Git. Your computer is the source of the code.
Deploy by itself with a webhook
You still connect the repository and the key, and the button stays for when you want to deploy by hand. A webhook only saves you the click. In the card open Webhook for pushes, copy the URL and the secret, and add a webhook in your Git host (GitHub: Settings, Webhooks, content type application/json, event Just the push event). After that:
- a push to the
stagingbranch deploys the staging copy; - a push to the live branch deploys the live site if you chose deploys to the live site by itself in the card, and otherwise waits for your click. The default is to wait.
A deploy started by a webhook goes through the same check and automatic rollback, and shows in the history of the card with the word webhook.
What a deploy does
- FlyNode fetches the branch with your key and checks that it looks like a WordPress site. A repository above 1 GB is refused, and a public repository is refused.
- It reads
fn-config.phpandfn-deploy.sh(see below) and checks them before anything changes. - The live site goes into maintenance mode for a moment. The files of the site are saved aside for the way back.
- The files become exactly what is in the branch. Files that are not in the branch are removed, except the ones listed below.
- The settings of
fn-config.phpand the commands offn-deploy.share applied. - FlyNode checks that the home page and the login page work and that WordPress starts. If the check fails, the old files and the old
wp-config.phpare put back and the deploy shows Rolled back with the reason.
Never replaced or deleted by a deploy: wp-config.php (the site's own database settings), .htaccess, the media library (wp-content/uploads), caches, backup folders, FlyNode's own files and cache drop-ins such as object-cache.php.
WordPress core is kept by default. A deploy replaces wp-content and the files of your repository but leaves the live site's WordPress core alone, so a WordPress update on the live site is not undone by an older copy in Git. The card has a switch if you want the repository's core to win instead.
Plugins and themes you add or update on the live site are kept. If someone installs a plugin in wp-admin on the live site, or updates one there, a deploy does not remove it: a plugin or theme that is only on the live site stays, and one whose version on the live site is newer than the branch's stays too. Everything else in the branch wins. The deploy message lists what was kept. These plugins are not in your repository, so they are not on your computer either: press Download for Local again to get them, or install the same plugin in Local and push. If you want the branch to decide everything, change Plugins and themes added or updated on the live site in the Git Sync tab to The branch decides.
Settings for the live site: fn-config.php
Your wp-config.php stays on your computer. The live site keeps its own, with its database login and keys. To set constants for the live site, such as turning debug on, put plain define() lines in a file called fn-config.php at the top of the repository. A deploy copies them into the live wp-config.php. The file is only read, never run. Constants that belong to the live site (database login, keys and salts, site address, folders, cache, multisite) are skipped. If the deploy is rolled back, the old wp-config.php comes back too.
<?php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'MY_PLUGIN_MODE', 'production' );
The database stays where it is: fn-deploy.sh
Settings that WordPress keeps in the database do not travel with Git: which plugins are active, theme options, menus and widgets. A plugin you add in Local arrives on the site as files but is not switched on. To repeat such a change, put commands in a file called fn-deploy.sh at the top of the repository, one per line. They run after the files are in place. Only plain wp-cli commands from this list are allowed: option, plugin, theme, rewrite, cache, transient, cron, search-replace, language, menu, widget, sidebar, role, cap, elementor, wc. No pipes, ; or $. Up to 50 commands.
# fn-deploy.sh
wp plugin activate my-plugin
wp option update blogdescription "Our new tagline"
wp rewrite flush
wp cache flush
Content (posts, pages, orders) is made on the live site. It is not meant to travel back from your computer. If you need the live content on your computer, press Download for Local again and import it.
If something goes wrong
- "That branch does not look like a WordPress site": the repository was made from the wrong folder. It must be the folder that holds
wp-content, which isapp/publicin Local, not its parent. - "This repository is public": make it private in your Git host. The repository can hold site settings, so FlyNode refuses a public one.
- Could not read the branch: check that the key is still in the repository's deploy keys and that the branch exists.
- Rolled back: the new files broke the site, so the old ones were put back. The message says why. Fix it on your computer and deploy again.
- The webhook does nothing: look at the recent deliveries in your Git host. A wrong secret shows as a 401 answer. Use Create a new secret in the card and paste it into the webhook.
- Staging deploys need a staging copy of the site (see Staging and Push to Production).
Good to know
- One repository per site, and a key belongs to one connection. Disconnect removes the connection and its key; the site stays as it is.
- Git sync moves files only. Database changes and content still go from staging to live with Push to Production.
- Connections made earlier for a single theme or plugin keep working and stay listed on the card until you disconnect them.
Still stuck?
Open a support ticket from your dashboard and include the container name.