Skip to Content
RcmadeDocs
Ray SecretsReferenceCLI ReferenceWorkspace

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 / OptionTypeDescription
-w, --workspace <id_or_name>stringTarget workspace ID or slug to link or query, bypassing interactive selection
-p, --project <id_or_name>stringTarget project ID or slug to link or query, bypassing interactive selection
-e, --env <name>(--environment <name>)stringTarget environment name (e.g. development, staging, production) to read or modify
--overwritebooleanForce overwrite of existing secrets or local files without interactive confirmation prompts
--standalonebooleanInitialize directory as an independent root workspace, ignoring enclosing parent workspaces
--parentbooleanOperate 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 init

2. 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 development

3. Standalone root workspace initialization in monorepos

Initializes an independent root workspace in a subdirectory, ignoring enclosing parent workspaces.

ray init --standalone

4. Inherit configuration from parent ancestor workspace

Links this directory to the nearest parent workspace instead of creating a nested workspace configuration.

ray init --parent

Reconfigures the current directory to bind to a different project, updating .ray/workspace.json.

ray init --project api-backend --overwrite

Exit Codes

CodeMeaningRecommended Action
0Success. The command completed with no errors.None required.
1Runtime or execution failure. A child process returned non-zero status or a general error occurred.Inspect process output or run with --verbose.
2Authentication failed. Token is missing, expired, or invalid.Run `ray login` or update `RAY_TOKEN`.
3Configuration or binding error. Project or environment context was not found.Run `ray init` or specify `--project` and `--env`.
4Network 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.