To write a secret to a path on SecretHub, you can use the
secrethub write [options] <path>
This automatically encrypts your secret and writes it to a new version at the path you provide.
Depending on how you configure the command, it reads the secret from the following inputs:
- If the
--clipflag is provided, it reads from the clipboard.
- If input is piped, it reads from
echo "hello world" | secrethub write path/to/secret
- If no other input is given, it aks you to type in the secret value.
Prompting for input normally ends after pressing
ENTER. If the
--multilineflag is used, input continues until an EOF is reached (see flag details).
- The path to write the secret to. Note that secrets are append only, so
writealways creates a new version of a secret.
- Use clipboard content as input. This can be useful when copy-pasting a value from a graphical user interface.
- Do not trim leading and trailing whitespace in the secret. Use this when you want to preserve the original content of the secret, regardless of whether your system adds a newline to the input (as is common on e.g. Posix systems).
-m, --multiline(boolean) new in v0.31.0
- Prompt for multiple lines of input, until an EOF is reached.
On Linux/Mac, press
CTRL-Dto end input. On Windows, press
ENTERto end input. If this flag is used, typed input is shown to the user. If multiline input should be hidden, please use a different input option (e.g. pipe input to
stdin, use the
--in-file, or use the
- Use the contents of this file as the value of the secret.