To write a secret to a path on SecretHub, you can use the write command:

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:

  1. If the --clip flag is provided, it reads from the clipboard.
  2. If input is piped, it reads from stdin, e.g. echo "hello world" | secrethub write path/to/secret
  3. If no other input is given, it aks you to type in the secret value.


<path> (string)
The path to write the secret to. Note that secrets are append only, so write always creates a new version of a secret.


-c, --clip (boolean)
Use clipboard content as input. This can be useful when copy-pasting a value from a graphical user interface.
--no-trim (boolean)
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).