Skip to content

Unable to clone private repo within docker container: unable to find any valid known_hosts file, set SSH_KNOWN_HOSTS env variable #391

@manuel-koch

Description

@manuel-koch

Since installing labours failed ( installing scipy stuff ) on my platform (MacOS 12.6.3 M1) I tried to use the docker image to run hercules.
I want to analyze a private repo on bitbucket, hence I need to provide my SSH key to hercules.
Somehow the clone of the repo fails:

( redacted private information regarding the repo )

$ docker run -v ~/.ssh/id_rsa:/key/id_rsa  --rm srcd/hercules hercules --burndown --pb --ssh-identity /key/id_rsa [email protected]:<MY_PRIVATE_REPO>.git
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
2023/03/17 12:06:32 failed to open [email protected]:<MY_PRIVATE_REPO>.git: unable to find any valid known_hosts file, set SSH_KNOWN_HOSTS env variable
panic: failed to open [email protected]:<MY_PRIVATE_REPO>: unable to find any valid known_hosts file, set SSH_KNOWN_HOSTS env variable

goroutine 1 [running]:
log.Panicf(0x148268a, 0x15, 0xc000139a48, 0x2, 0x2)
	/usr/local/go/src/log/log.go:345 +0xc0
main.loadRepository(0x4000800efd, 0x42, 0x0, 0x0, 0x1, 0x4000800eea, 0x12, 0x370000c000139bb0)
	/root/src/cmd/hercules/root.go:120 +0x4c9
main.glob..func3(0x20cca60, 0xc000bd0550, 0x1, 0x5)
	/root/src/cmd/hercules/root.go:218 +0x2f5
github.com/spf13/cobra.(*Command).execute(0x20cca60, 0xc000032250, 0x5, 0x5, 0x20cca60, 0xc000032250)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x20cca60, 0xc000bce800, 0xc000139f50, 0x839ecf)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ea
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:800
main.main()
	/root/src/cmd/hercules/root.go:516 +0x31

How can I use hercules to analyze a private repo ?

$ docker image ls | grep hercules
srcd/hercules                                                       latest    5c0c71aebf8c   2 years ago     1.23GB

Found a similar ticket that mentions an updated go-git package that fixes the problem. Maybe the docker image is way out-of-date ( looks like 2 years old ) and may not include the latest hercules build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions