Skip to content
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
Open
@vermapratyush

Description

@vermapratyush

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions