sow init
sow init creates a Workspace with sow.yml and private .sow/ state (existing workspaces configured with either sow.yml or sow.yaml are accepted). If the configuration already declares Repositories and Dists, it creates the missing ones. Run it again to complete initialization after adding declarations.
Synopsis
DIR defaults to the current directory. To initialize another directory, pass its path as DIR.
Description
A fresh init writes a minimal config and the private state directory:
.sow/ stores private state, locks, and recovery records with directory permissions 0700. Serve the Repository directories over HTTP; keep .sow/ private.
Options
| Flag | Description | Default |
|---|---|---|
--passfile PATH |
Password file for this invocation | per-key config, then SOW_GPG_PASSFILE |
--json |
Output JSON | false |
-h, --help |
Show help | — |
Idempotence rules
A new configuration uses schema: sow/v3 and architectures x86_64 and aarch64. It declares no Repository. Add one with sow repo new or edit sow.yml first.
init preserves an existing configuration and initializes missing declared objects. It can use a non-empty directory if no file conflicts with a reserved SOW path. When all declared objects are already initialized, the counters are zero.
Apply a declared configuration
If sow.yml already describes Repositories and Dists, init creates the missing directory trees,
SQLite databases and empty indexes for them. SOW skips already-initialized objects, so the counters
tell you what this run did.
Every Dist created this way has valid empty indexes. An RPM Dist gets empty repodata/ in each architecture view. A DEB Dist gets empty Packages and Packages.gz files, by-hash entries, and a Release file.
Running it a second time changes nothing:
Locking and recovery
If initialization is interrupted, rerun sow init for the same directory. SOW first completes or rolls back the interrupted operation, repairs any missing per-repository lock files under .sow/workspace.lock, and initializes any remaining declared objects. It waits for other Workspace writers to finish. If a populated .sow/ directory has lost .sow/workspace.lock, init fails with an integrity error until all writers are stopped and the owner creates an empty 0600 .sow/workspace.lock before rerunning sow init.
Examples
Bootstrap a Workspace and add Repositories by hand:
Initialize a directory other than the current one:
Initialize from a config file under version control:
Exit codes
| Code | Trigger |
|---|---|
0 |
Workspace initialized, or already initialized (no-op) |
1 |
Runtime I/O error writing the config or state directory |
2 |
Usage error, or an existing sow.yml that fails to parse or validate |
3 |
Partial success — some declared Repositories/Dists were committed and at least one failed |
5 |
The Workspace journal could not be recovered to a terminal state |
6 |
An existing file collides with a SOW reserved path, or a declared Repository database requires sow repo migrate |
See also
- First Workspace — the ten-minute guided version
- Managed Workspaces — the three-layer model
- sow.yml Reference — every configuration key
- sow repo and sow dist
- Repository Layout — what
.sow/contains