Write your first secret

Now that you have a repository set up, let’s write some secrets. First, run the write command and type Hello World when prompted:

secrethub write your-username/start/hello-world

A secret named hello-world with value Hello World is now written to SecretHub. Under the hood, everything is encrypted automatically.

Note: because we know you love to script, write also accepts input on stdin:

echo "Hello World" | secrethub write your-username/start/hello-world

To read the newly created secret, simply use the read command on the same path:

secrethub read your-username/start/hello-world

Pro tip: you can use SecretHub for passwords too

While SecretHub is mainly meant for infrastructure secrets, it can be equally useful for managing passwords. Whenever you want to generate a random password, you can use the generate command.

The following line generates a random password for some example.com website (consisting of 22 characters by default):

secrethub generate rand your-username/start/example.com

When you need to provide a password in a graphical user interface, simply use the read command with the --clip flag. This copies the secret value to your clipboard for 45 seconds.

secrethub read --clip your-username/start/example.com 

️️➡️ Next, let’s move on to using secret versions.