Skip to content

Instantly share code, notes, and snippets.

@li-salvadorlopez
Created January 17, 2015 00:12
Show Gist options
  • Save li-salvadorlopez/5f504a6cac899fa62663 to your computer and use it in GitHub Desktop.
Save li-salvadorlopez/5f504a6cac899fa62663 to your computer and use it in GitHub Desktop.
gradle ssh plugin
/*
get the rsa key of your server:
$ ssh-keyscan -t rsa server_ip
# server_ip SSH-2.0-OpenSSH_4.3
server_ip ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwH5EXZG...
and on the client, add this key to ~/.ssh/known_hosts:
server_ip ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqx9m529...(the offensive key)
server_ip ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwH5EXZG...
*/
plugins {
id 'war'
id 'org.hidetake.ssh' version '1.0.1'
}
remotes {
webServer {
host = 'hostname'
user = 'username'
identity = file('id_rsa')
}
}
task deploy << {
ssh.run {
session(remotes.webServer) {
put "$rootDir/build/libs/gradle-ssh-plugin.war", '/home/user/'
execute 'unzip /home/user/gradle-ssh-plugin.war -d /home/user/gradle-ssh-plugin/'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment