From 538c6445867066ff2b77b6032c09aa562be7f984 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Sat, 19 Sep 2020 11:45:03 -0700 Subject: [PATCH] cli: don't ask for password if repository is not connected (#627) --- cli/config.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/config.go b/cli/config.go index 04df3862a..821d24569 100644 --- a/cli/config.go +++ b/cli/config.go @@ -47,8 +47,12 @@ func onCtrlC(f func()) { } func openRepository(ctx context.Context, opts *repo.Options, required bool) (repo.Repository, error) { - if _, err := os.Stat(repositoryConfigFileName()); os.IsNotExist(err) && !required { - return nil, nil + if _, err := os.Stat(repositoryConfigFileName()); os.IsNotExist(err) { + if !required { + return nil, nil + } + + return nil, errors.Errorf("repository is not connected. See https://kopia.io/docs/repositories/") } maybePrintUpdateNotification(ctx)