Skip to main content
Every write in KiwiFS is a git commit, so backing up means pushing that repository somewhere else. Backup sync pushes to a git remote on an interval while the server runs, and kiwifs restore clones it back. Before each push, KiwiFS fetches the remote branch and rebases local commits onto it. This avoids the routine non-fast-forward failure you’d get when another server, laptop, or teammate pushed to the same branch first.

Turn on backup sync

1

Add a backup section

.kiwi/config.toml
2

Make sure the server can push

The KiwiFS process pushes with your system git, so it needs SSH keys or credentials for the remote.
3

Start the server

Terminal
KiwiFS pushes once at startup, then on every interval, and once more on shutdown.
In containers, set KIWI_BACKUP_REMOTE, KIWI_BACKUP_INTERVAL, and KIWI_BACKUP_REBASE_BEFORE_PUSH instead. They override the TOML values.

Check the last push

Terminal
Response
When a push fails, success is false and error holds the reason.

Push once from the CLI

Terminal
Without --remote, the command reads remote, branch, and rebase_before_push from [backup] in .kiwi/config.toml.

Restore from a remote

kiwifs restore clones a backup into an empty directory.
Terminal
Search indexes aren’t part of the backup. KiwiFS rebuilds them in .kiwi/state/ when the server starts.

What happens before a push

With rebase_before_push on, each push:
  1. Points a git remote named backup at your configured URL.
  2. Resolves the branch from [backup].branch, then the current branch, then main.
  3. Checks whether the branch exists on the remote. If it doesn’t, KiwiFS skips the rebase and the push creates it.
  4. Fetches backup/<branch>.
  5. Refuses to rebase if the worktree has uncommitted changes.
  6. Saves the current HEAD at refs/kiwifs/backup-pre-rebase, then rebases local commits onto backup/<branch>.
  7. Pushes the branch.
  8. Checks that the remote branch now matches the local HEAD, and logs a warning if it doesn’t.
KiwiFS automates only this clean path. It never force-pushes and never resolves conflicts. If the rebase fails, KiwiFS aborts it and reports the error in the backup status. Turn the rebase off only when another process owns git synchronization and you want a plain push:

Troubleshooting

Commit or discard the local changes, then push again.
Terminal
Two writers changed the same lines. Resolve the conflicted markdown files with normal git tools.
Terminal
Run git rebase --abort to give up and return to the pre-rebase state.
Terminal

Versioning

How every write becomes a commit.

Docker

Configure backup with environment variables.
Last modified on October 19, 2026