"主机密钥验证失败"在docker alpine 9 build期间

时间:2018-02-19 22:56:31

标签: git docker alpine

我试图克隆私人git repo并遇到此错误:

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

看起来我需要将git主机添加到known_hosts文件中。但是,这个版本的来自Docker的alpine没有~/.ssh/known_host文件。

/etc/ssh/存在。

1 个答案:

答案 0 :(得分:3)

使用https不需要设置SSH密钥,也不会要求输入密码:

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