Skip to content

Commit 18ee555

Browse files
committed
Merge branch 'port-forwarding-auth-method' into 'master'
fix: warn about missing auth method See merge request postgres-ai/database-lab!132
2 parents 1a01f67 + 74a3cc3 commit 18ee555

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/cli/commands/port_forwarding.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package commands
77

88
import (
9+
"errors"
910
"fmt"
1011
"net"
1112
"net/url"
@@ -64,7 +65,11 @@ func getAuthMethod(cliCtx *cli.Context) (ssh.AuthMethod, error) {
6465
return authMethod, nil
6566
}
6667

67-
return portfwd.SSHAgent(), nil
68+
if sshAgent := portfwd.SSHAgent(); sshAgent != nil {
69+
return sshAgent, nil
70+
}
71+
72+
return nil, errors.New("no auth method found. Either define `--identity-file` flag or add your certificate to the SSH agent")
6873
}
6974

7075
// BuildHostname builds a hostname string.

0 commit comments

Comments
 (0)