primo push and primo pull move content and code between your local workspace and an already-deployed Primo server. Use them to keep production in sync with Git, or to grab a copy of a remote site for local development.
Authenticate First
Before pushing or pulling against a hosted server, log in:primo pull — Hosted → Local
Pull an entire server (every site plus the shared library) into local files:
[dir]— Output directory (defaults to./<server-hostname>)-s, --server <url>— Server URL (alternative to the positional argument)-t, --token <token>— Auth token (overrides stored credentials)
primo dev. Image files in uploads/ are pulled as real binaries — the directory is self-contained.
Each pull also records which server revision your files came from (in .primo/sync-state.json). The next push uses it to check that nobody has changed the site in the meantime. See Push safety.
primo push — Local → Hosted
Push local changes to a hosted server:
-s, --server <url>— Server URL--site <id>— Push to a specific site ID--only <slug>— Only push the named folder undersites/(skipslibrary/)-d, --dir <dir>— Workspace directory (default:.)-t, --token <token>— Auth token--force— Overwrite changes made on the server since your last sync, after confirmation. A backup is saved first.--yes— Confirm--forcewithout the interactive prompt (for scripts and CI)--preview— Ask the server for an import diff without applying changes. Also reports conflicts that would block a normal push; skips library uploads.--dry-run— Show planned operations without sending requests--publish— Publish the hosted sites after all selected pushes succeed; requires a compatible server--json— Return machine-readable push and publication results
By default, a push updates the hosted CMS draft without publishing. Review it in the hosted editor and choose Publish, or use
primo publish or primo push --publish with a compatible server.Push Safety
A push replaces the server’s copy of a site with your local files. To keep it from silently erasing edits a client made in the CMS, Primo checks first: if the site changed on the server since your last pull or push, the push is refused before anything is uploaded:Recover from a refused push
1
Save your local work
Commit it, or copy the changed files somewhere outside
sites/. A pull overwrites your local files with the server’s version.2
Pull
3
Redo your change and push
Re-apply your edits on top of the pulled files (with Git,
git diff shows what the client changed), then push again.Watch: Recover from a refused CLI push
This local demonstration uses an isolated server and an explicit token. A hosted workflow can use the credentials saved byprimo login. The final push updates the CMS; publish separately in the hosted editor.
Download video · Download captions
Read the walkthrough
Read the walkthrough
- Pull from the server to record a baseline. Here
PRIMO_SERVERpoints to an isolated local demo. - After a local code edit and a server edit, push refuses to overwrite the newer server version.
- Save the edited file outside
sites/, then pull the latest server copy. - Reapply the saved code edit and push again. The server change is preserved.
- The pushed headline appears in the CMS. On a hosted server, review and Publish to update the public site.
Overwrite on purpose with --force
If you’re sure your local files should win:
--force --yes.
”No saved baseline”
--force if your files should replace the server’s. Pushing a site that doesn’t exist on the server yet needs no baseline.
Duplicate folders after a site rename
Pull names site folders from the site name. If a rename changes that folder name, a later pull can leave the previous folder alongside the new one. Both copies have the samesite_id, so the CLI refuses to push them.
Save any edits you need, then move the older copy outside sites/ (for example, into _backups/). Keep one folder per site_id before pushing again. To create a separate site from a copy, remove its site_id and register it with primo add.
Version requirements
Push safety needs primo-cli 0.2.0 or later and Primo server 3.3.0 or later:- An older CLI pushing to an existing site on a 3.3.0+ server gets
428 Push requires a sync baseline. Update the CLI and pull first, or explicitly force an overwrite with a backup.Update withnpm i -g primo-cli@latest, then pull. - CLI 0.2.0 refuses to push to an older server:
Server does not support safe pushes. Update the CMS first; no upload was attempted.
Library-Only Sync
To move just the shared block library between workspaces and servers:primo library push has the same push safety check, --force, and --yes options as primo push.
This is useful when curating a block library independently of any particular site.
What Gets Synced
site.yaml metadata (name, group) round-trips. host is treated as per-environment routing config and is never overwritten by file sync.
Common Workflows
Edit in production, snapshot to Git
Edit locally, push to production
Move a site between servers
Next Steps
Deploy
Deploy a workspace as an editable CMS or static site
Local Development
Run the local CMS with file/CMS sync