> ## Documentation Index
> Fetch the complete documentation index at: https://graph.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# dive secret set

> Store a secret in the OS credential store

Reads the value with hidden input when stdin is a terminal, or from stdin when it is piped; one trailing newline is dropped. The value is never accepted as an argument, where it would land in shell history. Storing a name again replaces its value.

Without --project the value is shared by every project on this machine. With --project it applies only to this project, keyed by the `[project] id` in .dive/config.toml, which is generated on first use. A name resolves from the environment first, then this project's value, then the shared value.

## Arguments

**NAME** `string` *required*

The variable name, as `${NAME}` references it

## Options

**--project** `boolean`

Store the value for this project only

**--json** `boolean`

Print a JSON envelope instead of text

## Global options

**-v, --verbose** `integer`

Increase log verbosity (-v info, -vv debug, -vvv trace)

```bash Usage theme={null}
dive secret set [OPTIONS] <NAME>
```

```bash Example 1 theme={null}
dive secret set ANTHROPIC_API_KEY
```

```bash Example 2 theme={null}
dive secret set SLACK_BOT_TOKEN --project
```

```bash Example 3 theme={null}
printf %s "$TOKEN" | dive secret set GITHUB_TOKEN
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.