2016-01-06 58 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同樣不利。