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.
ssh: handshake failed: knownhosts: key mismatch #738
Open
Description
I tried to write codes for cloning a repository via ssh protocol, it failed with the error:
ssh: handshake failed: knownhosts: key mismatch
my codes:
package main
import (
"fmt"
"os"
git "gopkg.in/src-d/go-git.v4"
ssh "gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
)
func main() {
auth, err := ssh.NewPublicKeysFromFile("git", "/root/.ssh/id_rsa", "")
fmt.Println(err)
_, err2 := git.PlainClone("./dvue", false, &git.CloneOptions{
URL: "[email protected]:work/LocalService.git",
ReferenceName: "refs/head/master",
Auth: auth,
Progress: os.Stdout,
})
fmt.Println(err2)
}
When I tried the following command, it was all right.
git clone [email protected]:work/LocalService.git