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 rand command:

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

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.
<length> (int)
The length of the generated secret. Defaults to 22.


-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: !@#$%^*-_+=.,?