Write your first secret

Now that you have created an account, you can start using the CLI. The first thing to do is create a repository with the repo init command:

secrethub repo init your-username/start

Repositories work a lot like a Unix filesystem, so you can use the commands ls, tree, mkdir, and rm to manipulate their contents.

Now let’s write a secret. 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.

Use the ls command to list the contents of your repository:

secrethub ls your-username/start

To read the newly created secret, simply use the read command:

secrethub read your-username/start/hello-world:latest

Secrets are automatically versioned so you’ll never accidentally overwrite a secret. You can access a specific version of a secret by appending the version number to the path, e.g. :1. When no version number is given, it defaults to :latest.

A few cool features

  • Because we know you love to script, write also accepts input on stdin:
    echo "Hello World" | secrethub write your-username/start/hello-world
    
  • Whenever you need to copy-paste a secret into a GUI, you can use the --clip flag to copy the value to the clipboard for 45 seconds.
    secrethub read --clip your-username/start/hello-world
    
  • To generate random secrets, you can use the built-in generate command:
    secrethub generate rand your-username/start/generated