ray init
Link current directory to a Ray Secrets project
Link current directory to a Ray Secrets project
Synopsis
ray init [options]Flags & Options
| Flag / Option | Type | Description |
|---|---|---|
-w, --workspace <id_or_name> | string | Target workspace ID or slug to link or query, bypassing interactive selection |
-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 |
--overwrite | boolean | Force overwrite of existing secrets or local files without interactive confirmation prompts |
--standalone | boolean | Initialize directory as an independent root workspace, ignoring enclosing parent workspaces |
--parent | boolean | Operate on the nearest parent ancestor workspace instead of initializing a nested workspace |
Common Examples
1. Interactive guided project and workspace linking
Launches interactive prompts to select a workspace, project, and default environment, generating .ray/workspace.json.
ray init2. Headless initialization for CI/CD automation
Explicitly binds the directory to a target project and environment without interactive prompts.
ray init --project web-app --env development3. Standalone root workspace initialization in monorepos
Initializes an independent root workspace in a subdirectory, ignoring enclosing parent workspaces.
ray init --standalone4. Inherit configuration from parent ancestor workspace
Links this directory to the nearest parent workspace instead of creating a nested workspace configuration.
ray init --parent5. Overwrite existing workspace link
Reconfigures the current directory to bind to a different project, updating .ray/workspace.json.
ray init --project api-backend --overwriteExit 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.