diff --git a/cmd/restic/cmd_init.go b/cmd/restic/cmd_init.go index e4333b06e..827684b3e 100644 --- a/cmd/restic/cmd_init.go +++ b/cmd/restic/cmd_init.go @@ -15,17 +15,17 @@ func (cmd CmdInit) Execute(args []string) error { return errors.New("Please specify repository location (-r)") } + be, err := create(cmd.global.Repo) + if err != nil { + cmd.global.Exitf(1, "creating backend at %s failed: %v\n", cmd.global.Repo, err) + } + if cmd.global.password == "" { cmd.global.password = cmd.global.ReadPasswordTwice( "enter password for new backend: ", "enter password again: ") } - be, err := create(cmd.global.Repo) - if err != nil { - cmd.global.Exitf(1, "creating backend at %s failed: %v\n", cmd.global.Repo, err) - } - s := repository.New(be) err = s.Init(cmd.global.password) if err != nil {