强制SVNKit库使用当前登录用户的公钥?

时间:2015-06-12 14:48:41

标签: java bash svn

在bash上我可以运行svn add myfilesvn 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。

0 个答案:

没有答案