ray sync
Bi-directionally synchronize your local .env secrets with the server
Bi-directionally synchronize your local .env secrets with the server
Synopsis
ray sync [options]Flags & Options
| Flag / Option | Type | Description |
|---|---|---|
-p, --project <id_or_name> | string | Target project ID or slug to link or query, bypassing interactive selection |
-e, --env <name>(--environment <name>) | string | Target environment name (e.g. development, staging, production) to read or modify |
-b, --base(-t, --team) | boolean | Fetch canonical team environment secrets, ignoring personal workstation overrides (recommended for CI/CD) |
-l, --local | boolean | Target local override file (.env.local) instead of default canonical .env file |
--dry-run | boolean | Simulate command execution and preview changes without modifying remote vault or local filesystem |
-q, --quiet | boolean | Silence banners, progress spinners, and status output; only print process output and critical errors |
--ci | boolean | Optimize execution for headless CI/CD runners (disables spinners, prompts, colors, and update checks) |
Common Examples
1. Interactive bi-directional synchronization
Reconciles remote secrets with local .env files, prompting how to resolve missing keys and conflicts.
ray sync2. Synchronize with target environment
Explicitly synchronizes local .env variables with the staging vault instead of the workspace default.
ray sync --env staging3. Synchronize team baseline secrets only
Isolates canonical team secrets, ignoring any personal developer overrides in .ray/local.json.
ray sync --base4. Synchronize personal overrides to .env.local
Targets .env.local to manage personal developer overrides without modifying the shared .env file.
ray sync --local5. Dry-run preview of planned synchronization changes
Inspects remote changes and previews planned pushes and deletions without modifying any local files or remote vault state.
ray sync --dry-runExit Codes
| Code | Meaning | Recommended Action |
|---|---|---|
| 0 | Success. The command completed with no errors. | None required. |
| 1 | Runtime or execution failure. A child process returned non-zero status or a general error occurred. | Inspect process output or run with --verbose. |
| 2 | Authentication failed. Token is missing, expired, or invalid. | Run `ray login` or update `RAY_TOKEN`. |
| 3 | Configuration or binding error. Project or environment context was not found. | Run `ray init` or specify `--project` and `--env`. |
| 4 | Network or API failure. Failed to reach the Ray Secrets vault. | Check internet connection or run `ray doctor`. |
Ready to eliminate plaintext secrets?
Create a workspace to organize environments, invite your team, and generate scoped Service Tokens for CI/CD.