diff --git a/internal/sshdialer/ssh_dialer.go b/internal/sshdialer/ssh_dialer.go index 9d10c097f0..8c6aa5da68 100644 --- a/internal/sshdialer/ssh_dialer.go +++ b/internal/sshdialer/ssh_dialer.go @@ -222,29 +222,30 @@ func NewSSHClientConfig(url *urlPkg.URL, config Config) (*ssh.ClientConfig, erro // add signer from explicit identity parameter if config.Identity != "" { - s, err := loadSignerFromFile(config.Identity, []byte(config.Identity), config.PassPhraseCallback) + signer, err := loadSignerFromFile(config.Identity, []byte(config.Identity), config.PassPhraseCallback) if err != nil { return nil, fmt.Errorf("failed to parse identity file: %w", err) } - signers = append(signers, s) + signers = append(signers, signer) } - s, err := getSignersFromAgent() + // pulls signers (keys) from ssh-agent + signersFromAgent, err := getSignersFromAgent() if err != nil { return nil, err } - signers = append(signers, s...) + signers = append(signers, signersFromAgent...) // if there is no explicit identity file nor keys from ssh-agent then // add keys with standard name from ~/.ssh/ if len(signers) == 0 { defaultKeyPaths := getDefaultKeys() if len(defaultKeyPaths) == 1 { - s, err := loadSignerFromFile(defaultKeyPaths[0], []byte(config.PassPhrase), config.PassPhraseCallback) + signer, err := loadSignerFromFile(defaultKeyPaths[0], []byte(config.PassPhrase), config.PassPhraseCallback) if err != nil { return nil, err } - signers = append(signers, s) + signers = append(signers, signer) } }