Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 是否强制SVNKit库使用当前登录用户的公钥?_Java_Bash_Svn - Fatal编程技术网

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

Java 是否强制SVNKit库使用当前登录用户的公钥?,java,bash,svn,Java,Bash,Svn,在bash上,我可以运行svn add myfile或svn commit myfile,因为我用户的公钥位于svn用户的授权密钥文件中(在svn+ssh://svn-user@svn服务器上的ch/app/svn/repo/test/jars/appssvn user将是用户) 是否可以告诉SVNKit以某种方式对上述配置进行身份验证?因为无论我尝试什么,都会失败 下面是我最后一次尝试 SVNSSHAuthentication auth = new SVNSSHAuthentication("

在bash上,我可以运行
svn add myfile
svn commit myfile
,因为我用户的公钥位于svn用户的
授权密钥
文件中(在
svn+ssh://svn-user@svn服务器上的ch/app/svn/repo/test/jars/apps
svn user
将是用户)

是否可以告诉SVNKit以某种方式对上述配置进行身份验证?因为无论我尝试什么,都会失败

下面是我最后一次尝试

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);
我得到以下例外情况

org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: 
Commit failed (details follow):
svn: E170001: Authentication required for 'svn-user@svn+ssh://svn-server.ch'

我该如何正确地做呢?我没有密码,在Linux命令行上使用公钥,希望在java中使用相同的方式。如果可能的话,我也希望避免提供SVNUrl。

向下投票人您介意评论向下投票吗?您需要通过私钥。向下投票人您介意评论向下投票吗?您需要通过私钥。向下投票人您介意评论向下投票吗?您需要通过私钥。