Sync needs three prerequisites before it does anything: a private Git repository, a token that can read and write it, and a backup you know how to restore. The setup screen walks through the first two. The third is on you.
You need a user who can manage options on this install. The Sync screen lives under StaticScope → Sync, and every endpoint behind it requires that capability.
Take a backup first. The first sync writes every post, page and referenced image to the repository. It is mostly an outward push, but you are connecting your content to an automated process that writes posts in both directions. Know how to restore before you need to.
Requirements
- WordPress 6.3 or newer.
- PHP 7.4 or newer, with cURL and zlib.
- StaticScope active. If it is not, every admin screen tells you
Content sync needs StaticScope to be active. - A private Git repository reachable over HTTPS. GitHub, GitLab, Gitea, Forgejo or a bare repository behind
git http-backendall work. - An access token that can read and write that repository. It may be blank only for an unauthenticated repository, with a caveat covered below.
- HTTPS. SSH remotes are not supported.
Sync does not create, delete or resize the repository. Repository administration belongs to you, and a token that can only touch one repository should not be able to create more.
The repository
Create a repository that is separate from the one StaticScope uses to publish. Never reuse the publishing repository. The content repository holds drafts and private posts, it needs a token with write access and it will accumulate media. Keeping it separate keeps those permissions and that history away from the deploy process.
“Empty” means no conflicting managed content. A README, a licence or a .gitignore on the first commit is fine. Unknown files are preserved, and existing content under the managed folders is read and merged. The repository uses this layout:
items/<uuid>.json posts and pages
attachments/<uuid>.json media records
media/<git-blob-id> files, on the <branch>-media branch
environments/<site>.json each site’s environment fingerprint
The branch defaults to main. Media lives on a parallel branch named main-media. Records are deterministic JSON: sorted keys, UTF-8, unescaped slashes and unicode, \n line endings and one trailing newline. The same content should produce the same bytes on every site, which is what makes a text diff and a Git commit meaningful.
Token scopes
Use a fine-grained token scoped to the one repository. A token with access to every repository on the account turns one compromised WordPress install into a much larger problem.
| Host | Username | Scope | Notes |
|---|---|---|---|
| GitHub | x-access-token | Fine-grained token, Contents: read and write | Select only this repository. The repository must be private. |
| GitLab | oauth2 | write_repository | Project must be private, not internal. |
| Gitea | your username | Repository read and write | Settings → Applications → Generate token. |
| Forgejo | your username | Repository read and write | A token as username with an empty password also works. |
| Your own server | whatever the server expects, may be blank | Read and write to the bare repository | Serve over HTTPS with git http-backend, or put Gitea or Forgejo in front. No SSH. |
The token is stored in the database in plain text and sent as the password on every request. Scope it tightly, use HTTPS and treat database access as token access. Your Git host can read everything in the repository, including unpublished drafts.
Step 1: make the repository
Open StaticScope → Sync. Before a connection exists, the screen shows two numbered steps. The first is Where should content live?, with a tab for each built-in host.
Pick your host and follow its notes. The screen gives you Create the repository and Create a token links where the host has stable URLs, the steps for making a token, and an example clone address. GitHub notes that a README, licence or .gitignore on the first commit is fine. GitLab notes that the project must be private. Gitea and Forgejo point at Settings → Applications → Generate token. The “My own server” tab suggests git init --bare site-content.git.
If you use your own server, make sure the repository is reachable over HTTPS and that post_max_size and your web server’s body limit are large enough for a media batch. A bare repository behind PHP will reject large pushes long before Sync has an opinion about them.
Step 2: connect this site
The second step is Connect this site. The screen says: “Paste the clone address and the token. StaticScope checks them before saving anything.”
| Field | What to enter |
|---|---|
| Repository address | The clone address, ending in .git. The field note says: “The clone address of a private repository. It must be separate from the one that publishes the site.” |
| Access token | A token that can read and write the repository. The field note says: “A token that can read and write the repository. It is never shown again once saved.” |
| Automatic sync | Checked by default. The label is “Check for changes every 15 minutes”. |
| Advanced → Branch | Defaults to main. Invalid names silently fall back to main, with no form error. |
| Advanced → Username | Sent with the token. The note says: “GitHub expects x-access-token, GitLab often oauth2, most others accept anything.” |
Press Connect and check. On success the screen moves to the configured view and toasts Connected.
What “Connect and check” tests
It tests read access only. The add-on reads the repository’s refs and saves the settings if that read succeeds. It does not push a test commit, so a read-only token passes Connect and check and then fails on the first sync with a push error.
A read check is not a write check. If the first sync fails with The token wasn’t accepted. Check that it can read and write this repository., the token is the first thing to inspect. Fine-grained GitHub tokens need this repository selected and Contents read and write.
An empty repository address is rejected with Enter the repository’s clone address, such as https://github.com/you/site-content.git. Changing the repository address or branch clears the base and the conflict queue, so the next sync behaves like a first sync. Change one on purpose, not while a review queue is open.
There is one form caveat worth knowing. On first setup the token input has the HTML required attribute until a token has been saved. The “My own server” instructions say you can leave it blank if the server needs no authentication, and the server does not reject a blank token, but the browser will refuse to submit the form without one. In practice, put a placeholder token in, connect, then use Remove token if the repository is unauthenticated. The form will require a token again the next time you reconnect.
Automatic sync and cron
With Automatic sync on and the site configured, WordPress schedules a sync every 15 minutes. The first run is five minutes after the schedule is created. It uses WP-Cron, so it only runs when the site gets traffic. On a quiet staging site that can mean never. Add a real cron job that hits wp-cron.php if you want background sync to be reliable.
Cron syncs content. It never builds or publishes. A failed cron run stores the error in staticscope_sync_error, which appears the next time the Sync screen loads. There is no separate cron log and no email.
Removing a token
The Content repository panel has Remove token. Its dialog says:
Remove the token? Sync stops until a new token is added. The repository, its content and this site’s content stay as they are.
The toast afterwards reads Token removed. Add a new one when you’re ready to sync.
Removing the token does not turn automatic sync off. A site counts as configured when it has a repository address and branch, whether or not a token is saved. The 15-minute cron keeps firing and, without a working credential, keeps failing and writing errors. “Sync stops” means it cannot succeed, not that the schedule is paused. Uncheck Automatic sync as well if you want quiet.
The first sync
Press Sync now. With an empty base, every post, every page, every referenced image and this site’s environment record are pushed. The status band says so beforehand: “The first sync sends your posts, pages and images to repository. It can take a minute.” Believe it. On a large site, the status read alone exports every post before the sync begins.
Documents that exist on only one side are kept or pushed. Documents that share a UUID but have different content become add conflicts rather than a silent overwrite. Independent installs generate different UUIDs per post, so two posts with the same slug usually coexist as separate documents instead of colliding.
If the repository is empty and there is nothing to push, no commit is made. That is not a failure. Check that the site has posts and pages with a syncable status: publish, draft, pending, private or future.
After setup: the Content repository panel
The configured screen keeps a panel at the bottom with the repository, branch, token state and last check.
| Action | What it does |
|---|---|
| Test connection | Reads the saved repository’s refs without changing anything. Success reads “Connected to host. The branch branch is empty, so the first sync will fill it.” or “Connected to host. branch is at short SHA.” Failures show the host’s message in the same panel. |
| Change connection | Opens the same form with Save connection. Saving runs the same read check and the same base-clearing rule. |
| Remove token | Clears the token, keeps the repository and branch. |
| Disconnect this site | Forgets the repository, token, base, review queue and sync state. Posts, pages and media are untouched, and the repository keeps everything. |
Last checked in the panel is the last finished sync, not the last time you pressed Test connection. Testing does not update it.
Disconnect is nearly complete rather than complete. It leaves this install’s site ID and the stored “built without sync” reason behind. In practice, the Overview warning about a preview missing synced changes can survive a disconnect until another build clears it. That is a code-derived quirk, not something the dialog warns you about.
Next
- How a sync runs: what happens after you press the button.
- Conflicts and review: what to do when both sides changed the same thing.
- Notices and errors: every message and its fix.