简体   繁体   中英

PowerShell SharpSvn Certificate issue?

I'm trying to do an svn checkout or update from SVN using PowerShell 2.0 and SharpSVN 1.7?

When I run TortoiseSVN outside of Powershell - I get a certificate error, and have to accept with a click and then I am connected. In PowerShell using SharpSvn, I get the following error:

Exception calling "CheckOut" with "2" argument(s): "Unable to connect to a repository at URL '...'"
At Z:\Temp\SVNTEST\svntest.ps1:64 char:20
+ $svnClient.CheckOut <<<< ($repoUri, $svnLocalPath)
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

The code is pretty staightforward, there ar some C# examples of adding an exception handler which traps an error and succeeds, I'm not sure if this is my issue or how to do this in PowerShell

Here's the code snippet - any help appreciated

[System.IO.Directory]::SetCurrentDirectory($currentScriptDirectory.Path)

$evidence = [System.Reflection.Assembly]::GetExecutingAssembly().Evidence

[Reflection.Assembly]::LoadFile(("...SharpSvn.dll"),$evidence)

$svnClient = new-object SharpSvn.SvnClient 

$repoUri = new-object SharpSvn.SvnUriTarget($svnUrl) 

$svnClient.Authentication.DefaultCredentials = New-Object System.Net.NetworkCredential($svnUsername,$svnPassword)

$svnClient.CheckOut($repoUri, $svnLocalPath) 
$svnClient.Authentication.add_SslServerTrustHandlers({
        $_.AcceptedFailures = $_.Failures
        $_.Save = $True
    })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM