拒绝HostKey:使用gradle ssh插件部署JAR时

时间:2016-04-02 14:04:10

标签: java gradle ssh gradle-ssh-plugin

我正在尝试使用Gradle上传jar并使用Gradle SSH插件:https://gradle-ssh-plugin.github.io/

不幸的是,目标执行时出现错误

* What went wrong:
Execution failed for task ':deploy'.
> reject HostKey: SERVERIPADDRESS

如何解决?

我发现Ant SSH任务有类似的错误,可以使用trust = true设置修复。不幸的是,我在这里找不到合适的选择。

即。显然,我需要配置SSH客户端,以便它接受主机的ID。

3 个答案:

答案 0 :(得分:14)

试试这个:

 ssh.settings {
      knownHosts = allowAnyHosts
 }

P.S:很抱歉编辑错误,是S.O.F的新手。

答案 1 :(得分:2)

您必须将服务器SSH密钥信息添加到SELECT `rid` as `id`, `name`, `info`, COUNT(*) as `count`, AVG(`food`+`drinks`+`service`+`ambience`+`hygiene`) as `average`, SUM(`food`) as `food`, SUM(`drinks`) as `drinks`, SUM(`service`) as `service`, SUM(`ambience`) as `ambience`, SUM(`hygiene`) as `hygiene`, concat(round(( SUM(`recommend`)/COUNT(*) * 100 ),2),'%') as `recommended`, `best_menu` as `best`, `best_service` as `service`, `voted` as `last vote` FROM `rating` JOIN `restaurants` ON `restaurants`.`id` = `rating`.`rid` WHERE `restaurants`.`id` IN (1,2,4) GROUP BY `rid` ORDER BY `best_menu`, `best_service`; 文件中。

获取ssh-info运行命令~/.ssh/known_hosts 并将其输出添加到ssh-keyscan -t rsa server.com

或使用~/.ssh/known_hosts

答案 2 :(得分:0)

如前所述,您需要接受/验证其他服务器。 另一个选择是通过ssh连接到服务器。通常会要求您接受服务器,并且服务器指纹将永久添加到您的known_hosts文件中。