Reputation: 109
I write a springboot project with gradle, and I want to deploy it.
Here comes part of my code in build.gradle
:
remotes {
localtest {
host = '192.168.0.116'
user = 'root'
password = '*****'
}
}
task deploytest(dependsOn: build) << {
ssh.run {
session(remotes.localtest) {
put from: 'build/libs/test-0.0.1-SNAPSHOT.jar', into: '/opt/test/'
execute "cd /opt/tieba"
execute 'nohup java -jar -Dspring.profiles.active=test test-0.0.1-SNAPSHOT.jar & echo $! > application.pid'
}
}
}
Then I run gradle deploytest
, but it meets a problem :
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\github\spring-projects\test\build.gradle' line: 97
* What went wrong:
Execution failed for task ':deploytest'.
> reject HostKey: 192.168.0.116
Details
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':deploytest'.
Caused by: com.jcraft.jsch.JSchException: reject HostKey: 192.168.0.116
gradle error details 01 gradle error details 02
Upvotes: 2
Views: 751
Reputation: 1691
Got the same issue, the server was using ED25519.
I deleted the corresponding line in ~/.ssh/known_hosts
, retrieved the rsa banner with ssh-keyscan -t rsa myserver.tld
and copied the result back to known_host
Looks better than setting knownHosts = allowAnyHosts
Upvotes: 1
Reputation: 109
I fix it by setting knownHosts = allowAnyHosts
in ssh config, complete setting is
remotes {
localtest {
host = '192.168.0.116'
user = 'root'
knownHosts = allowAnyHosts
password = '*****'
}
}
Upvotes: 0