diff --git a/Makefile b/Makefile
index eaa5319e3e7c50055e4b5cc30f73dcc43f11d644..a8f0f10a7a381795a21cc97faa45638a2a621ec3 100644
--- a/Makefile
+++ b/Makefile
@@ -2,15 +2,17 @@ PKG:=github.com/sapcc/nova-password
 APP_NAME:=nova-password
 PWD:=$(shell pwd)
 UID:=$(shell id -u)
+VERSION:=$(shell git describe --tags --always --dirty="-dev")
+LDFLAGS:=-X main.Version=$(VERSION)
 
 export GO111MODULE:=off
 export GOPATH:=$(PWD)/gopath
 export CGO_ENABLED:=0
 
 build: gopath/src/$(PKG) fmt
-	GOOS=linux go build -o bin/$(APP_NAME) $(PKG)
-	GOOS=darwin go build -o bin/$(APP_NAME)_darwin $(PKG)
-	GOOS=windows go build -o bin/$(APP_NAME).exe $(PKG)
+	GOOS=linux go build -ldflags="$(LDFLAGS)" -o bin/$(APP_NAME) $(PKG)
+	GOOS=darwin go build -ldflags="$(LDFLAGS)" -o bin/$(APP_NAME)_darwin $(PKG)
+	GOOS=windows go build -ldflags="$(LDFLAGS)" -o bin/$(APP_NAME).exe $(PKG)
 
 docker:
 	docker run -ti --rm -e GOCACHE=/tmp -v $(PWD):/$(APP_NAME) -u $(UID):$(UID) --workdir /$(APP_NAME) golang:latest make
diff --git a/README.md b/README.md
index 13adfb756ae17f4aa7770f6feaa89524107d0fb8..d823355e281894dc39cab9d4dd3486e9dd89acb4 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,7 @@ Flags:
   -d, --debug                     print out request and response objects
   -h, --help                      help for nova-password
   -i, --private-key-path string   a path to the RSA private key (PuTTY and OpenSSH formats) (default "~/.ssh/id_rsa")
+      --version                   version for nova-password
   -w, --wait uint                 wait for the password timeout in seconds
 ```
 
diff --git a/main.go b/main.go
index 3ed8caf6849a4e46f2c81825fd177e702a0be3df..7c2bb6ef0a046ea3cd9f163231efc9ff06356588 100644
--- a/main.go
+++ b/main.go
@@ -24,11 +24,14 @@ import (
 
 const MaxKeySize = 10240
 
+var Version string
+
 // RootCmd represents the base command when called without any subcommands
 var RootCmd = &cobra.Command{
 	Use:          "nova-password <server-name>|<server-id> [<server-name>|<server-id>...]",
 	Short:        "Get the admin password for an OpenStack server",
 	SilenceUsage: true,
+	Version:      Version,
 	PreRunE: func(cmd *cobra.Command, args []string) error {
 		if len(args) == 0 {
 			cmd.Usage()