我正在研究svn并尝试通过命令提示符执行checkout操作。这是我的命令
svn co --username=username --password=password "the url from where I want to checkout" "Path where I want to checkout"
运行此命令后,我得到的输出
Error validating server certificate for 'https://muurlname':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
- The certificate hostname does not match.
Certificate information:
- Hostname: PKI
- Valid: from Jul 21 06:11:01 2015 GMT until Jul 21 06:41:01 2017 GMT
- Issuer: PKI
- Fingerprint: FD:9B:96:09:E9:A3:A8:A8:81:78:7E:71:28:FE:BB:93:BF:D0:15:C7
(R)eject, accept (t)emporarily or accept (p)ermanently?
现在暂时按下(t)或(p)永久性地检查我的档案。
Restored 'D:\Adapters Code SVN\SVN Adapter Test\testfile1.txt'
Restored 'D:\Adapters Code SVN\SVN Adapter Test\checkfile.txt'
Checked out revision 1465.
现在我通过我的java代码执行相同的操作并通过processbuilder传递命令。但是我收到了一些SSL证书验证错误。
svn: E170013: Unable to connect to a repository at URL 'https://myurlname'
svn: E230001: Server SSL certificate verification failed: certificate issued for a different hostname, issuer is not trusted
在svn中是否有任何命令可以传递用户名和密码,并且不会给出任何ssl证书错误?
这是执行结帐操作的java代码
String url = "https://myWorkingUrl";
String checkoutPath = "D:\\Adapters Code SVN\\SVN Adapter Test";
String command = "svn checkout " + "--trust-server-cert --non-interactive "
+ "--username=hoh7kor --password=emmawatson " + "\"" + url + "\"" + " " + "\"" + checkoutPath + "\"";
ProcessBuilder pb = new ProcessBuilder();
pb.command("cmd.exe", "/c", command);
Process p = pb.start();
p.waitFor();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
String line2;
while ((line2 = br2.readLine()) != null) {
System.out.println(line2);
}
执行后,我将错误输出作为
svn: E170013: Unable to connect to a repository at URL 'https://myUrl'
svn: E230001: Server SSL certificate verification failed: certificate issued for a different hostname, issuer is not trusted
答案 0 :(得分:0)
尝试以下选项svn co --trust-server-cert --non-interactive ...
注意: 一定要真的知道你做了什么!由于某种原因,这个错误被抛出(可能是一个错误的证书,可能是一个自签名证书,可能是一个MITM!)
更新:此选项似乎仅适用于不受信任的CA(联机帮助页:accept SSL server certificates from unknown certificate authorities
)
但您的证书无效(而不是"只是"不信任)。 请参阅bypass ssl certificate validation in subversion以获取进一步提示