在bash上我可以运行svn add myfile
或svn commit myfile
,因为我的用户的公钥位于SVN用户的authorized_keys
文件内(svn+ssh://svn-user@svn-server.ch/app/svn/repo/test/jars/apps
{{1在SVN服务器上将是用户。
是否有可能告诉SVNKit以某种方式对上述配置进行身份验证?因为无论我尝试什么,它都会失败。
以下是我的最后一次尝试。
svn-user
我收到以下异常。
SVNSSHAuthentication auth = new SVNSSHAuthentication("myuser",
new File("/opt/home/myuser/.ssh/id_rsa"), null, 22, true, null, false);
log.debug("private key -> " + auth.getPrivateKeyFile().getAbsolutePath());
BasicAuthenticationManager authMgr = new BasicAuthenticationManager(
new SVNAuthentication[] { auth });
clientManager = SVNClientManager.newInstance();
clientManager.setAuthenticationManager(authMgr);
clientManager.getCommitClient()
.doCommit(new File[] { file }, false, message, null, null,
false, false, SVNDepth.INFINITY);
我该如何正确地做到这一点?我没有密码并在Linux命令行上使用我的公钥,并希望在java中使用相同的方式。如果可能的话,我还想避免提供SVNUrl。