2016-01-06 57 views
1

我通过chef 安装一个新的服务器和应对ssh私钥和公钥到它。捆绑安装从一个新的服务器由于git ssh密钥错误

创建它之后,我通过jenkins将应用程序部署到它并运行bundle install。失败是由于

Host key verification failed. 
fatal: The remote end hung up unexpectedly 

如果我ssh到服务器并运行bundle install命令自己,我得到提示

The authenticity of host 'bitbucket.org (104.192.143.1)' can't be established. 
RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40. 
Are you sure you want to continue connecting (yes/no)? 

同为github上

The authenticity of host 'github.com (192.30.252.129)' can't be established. 
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. 
Are you sure you want to continue connecting (yes/no)? yes 

我按是,捆绑完成。最重要的是,如果我再次运行jenkins作业,那么这个包会成功完成。

任何想法如何通过jenkins自动批准这些远程服务器的真实性?

回答

2

核准的信息保存在您的~/.ssh/known_hosts中,因此您可以将它与您的密钥一起复制,这样您就知道哪些密钥已被批准。

另外,您可以使用ssh-keyscan检索信息。然而,结果到服务器的known_hosts,注追加,如果你自动做你会对接受中间人的机器(因为你没有看到什么已被批准)的风险。

最后,您可以禁用主机检查ssh -o StrictHostKeyChecking=no github.com,但这对自动执行ssh-keyscan同样不利。