我想使用gradle将php文件转移到sever。我尝试了以下脚本,但我不如何通过用户名和密码。
plugins {
id 'org.hidetake.ssh' version 'x.y.z'
}
remotes {
webServer {
host = '192.168.1.101'
user = 'jenkins'
identity = file('id_rsa')
}
}
task deploy {
doLast {
ssh.run {
session(remotes.webServer) {
put from: 'example.war', into: '/webapps'
}
}
}
}
尝试像这样
plugins {
id 'org.hidetake.ssh' version '2.9.0'
}
ssh.settings {
knownHosts = allowAnyHosts
}
remotes {
webServer {
host = 'ip'
user = 'username'
password='password'
}
}
task deploy {
doLast {
ssh.run {
session(remotes.webServer) {
put from: 'src', into: '/home/Desktop/Gradle'
}
}
}