我无法使用带有我的私钥的Gradle SSH 插件连接到 SSH 主机。
在build.gradle
工作正常中指定密码:
remotes {
webServer {
host = '<IP>'
user = '<USER>'
password = '<PASSWORD>'
}
}
但是为了避免在构建文件中写入密码,我将环境设置为使用我的私钥进行连接,而无需从 shell 输入密码:
ssh <user>@<ip>
此命令在 shell 中工作,但我无法使用 Gradle 插件实现此目的。这是我的配置:
remotes {
webServer {
host = '<IP>'
user = '<USER>'
identity = file("${System.getProperty('user.home')}/.ssh/id_rsa")
}
}
错误是:
引起:com.jcraft.jsch.JSchException: USERAUTH 在 com.jcraft.jsch.UserAuthPublicKey.start(UserAuthPublicKey.java:119) 失败
由于我能够从 shell 连接,我的配置有什么问题?