This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Strict Host Checking #454
Open
Description
Hi,
I am trying to clone a git repo (SSH auth)
repo, err = git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
URL: <URL>,
Auth: getAuth(),
})
func getAuth() ssh.AuthMethod {
auth, _ := ssh.NewPublicKeysFromFile("git", path, "")
return auth
}
The above code works when the ~/.ssh/known_host file contains the remote host is verified. However when the server does not contain the host in the file. The git.Clone()
command fails with the error knownhosts: key is unknown
. I added StrictHostKeyChecking no
in ~/.ssh/known_hosts
file, however I still get the error.
Basically, I am not sure how to use ssh.InsecureIgnoreHostKey()
along with the helper method ssh.NewPublicKeys
Any suggested way to solve this?