diff --git a/cluster/hosts.go b/cluster/hosts.go index d0253998..3d1a2c49 100644 --- a/cluster/hosts.go +++ b/cluster/hosts.go @@ -3,6 +3,7 @@ package cluster import ( "fmt" "os" + "path/filepath" "strings" "syscall" @@ -124,6 +125,8 @@ func checkEncryptedKey(sshKeyPath string) (ssh.Signer, error) { func privateKeyPath(sshKeyPath string) string { if len(sshKeyPath) == 0 { return os.Getenv("HOME") + DefaultSSHKeyPath + } else if sshKeyPath[:2] == "~/" { + return filepath.Join(os.Getenv("HOME"), sshKeyPath[2:]) } return sshKeyPath }