While some secrets have to be manually generated (e.g. by clicking through a graphical user interface), others can be programmatically generated. That’s where the generate command comes in. When you want to generate a random password (or any random sequence of characters for that matter), you can use the generate command:

secrethub generate [options] <namespace>/<repo>[/<dir>]/<secret>

The generate rand command generates a random string and writes it to the given path.


<namespace>/<repo>[/<dir>]/<secret> (string)
The path to write the generated secret to.


-s, --symbols (boolean)
Include symbols in the generated secret. Because not all systems allow special characters, they are disabled by default. Generated passwords consist of lowercase letters (a-z), uppercase letters (A-Z) and numbers (0-9). By enabling symbols, the following special characters are added into the mix: !@#$%^*-_+=.,?
-l, --length (int)
The length of the generated secret. Defaults to 22.
-c, --clip (boolean)
Copy the generated value to the clipboard. The clipboard is automatically cleared after 45 seconds.