diff --git a/utils.go b/utils.go index 2e3391f..e55352e 100644 --- a/utils.go +++ b/utils.go @@ -227,12 +227,8 @@ func loadSingleKey(keyPath string, env *Environment) *SSHKey { key.PrivateKey = path parsedPath := ParsePath(filepath.Join(env.SSHPath, kt.KeyBaseName)) - absPath, err := filepath.Abs(filepath.Join(env.SSHPath, parsedPath)) - if err != nil { - return nil - } - if path == absPath { + if path == parsedPath { key.IsDefault = true } @@ -267,6 +263,10 @@ func ParsePath(path string) string { os.Exit(1) } + if !filepath.IsAbs(originFile) { + originFile = filepath.Join(filepath.Dir(path), originFile) + } + return originFile } return path