Jonathan N. Thinh
Jonathan N. Thinh

Reputation: 63

"Host key verification failed" during docker alpine 9 build

I'm trying to clone a private git repo and am running into this error:

npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

Looks like I need to add the git host to the known_hosts file. However, this version of alpine from Docker does not have a ~/.ssh/known_host file.

the /etc/ssh/ is present.

Upvotes: 0

Views: 2629

Answers (2)

Jonathan N. Thinh
Jonathan N. Thinh

Reputation: 63

I had to manually add hosts:

ssh-keyscan -Ht ecdsa >> /root/.ssh/known_hosts


below comment was correct:

Did you try adding your own known_hosts file? e.g. put in a echo 'git.example.com,192.168.234.100 ssh-rsa theverylongbase64key' >> ~/.ssh/known_hosts somewhere between apk add openssh-client and whatever command (looks like something launched with node) is doing the git operation. – wmorrell Feb 19 at 23:36 - WMORRELL

Upvotes: 1

Vikram Hosakote
Vikram Hosakote

Reputation: 3684

Using https does not need SSH keys to be setup and will not ask for a password:

git clone https://github.com/<username>/<repo name>.git

Upvotes: 3

Related Questions