8

I am trying to upload jar with Gradle and used Gradle SSH plugin: https://gradle-ssh-plugin.github.io/

Unfortunately, goal executed with error

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

How to fix?

I found that there is similar error with Ant SSH task and it can be fixed with trust = true setting. Unfortunately, I can't find appropriate option here.

I.e. apparently, I need to configure SSH client so that it accept host's ID.

Dims
  • 47,675
  • 117
  • 331
  • 600

3 Answers3

18

Try this:

 ssh.settings {
      knownHosts = allowAnyHosts
 }

P.S: Sorry for editing mistakes, new to S.O.F.

Shorn
  • 19,077
  • 15
  • 90
  • 168
Samir
  • 181
  • 1
  • 3
4

Run: ssh-keyscan -t rsa server.com >> ~/.ssh/known_hosts

Explanation: you have to add server SSH key info to your ~/.ssh/known_hosts file.

To obtain ssh-info run command ssh-keyscan -t rsa server.com and add its output to ~/.ssh/known_hosts

Max Farsikov
  • 2,451
  • 19
  • 25
0

As already said, you need to accept/validate the other server. Another option for that would be to just connect to the server via ssh. Normally you will be asked to accept the server and the servers fingerprint will be added permanently to your known_hosts file.

thm
  • 524
  • 1
  • 5
  • 10
  • how? without known_hosts, the plugin complains the file is not found – eastwater Jan 04 '21 at 05:32
  • I guess if the file doesn't exist under your home directory in the .ssh folder you can just create the file manually. Otherwise you can use the ssh-keyscan command as mentioned above (at least on a linux based system). See here for example: https://www.techrepublic.com/article/how-to-easily-add-an-ssh-fingerprint-to-your-knownhosts-file-in-linux/ – thm Jan 08 '21 at 19:42