I wrote code to programmatically clone a GitHub private repo to a local repo via libgit2sharp ( v0.21.0.176 )
var cloneOptions = new CloneOptions { BranchName = "master", Checkout = true };
var cloneResult = Repository.Clone( @"https://github.com/my-organization/my-repo.git", @"c:\github\my-organization\my-repo" );
exception thrown :
{LibGit2Sharp.LibGit2SharpException: Request failed with status code: 401
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
cloneResult value is null ( never set due to exception thrown )
Note that the identical 401 exception is thrown whether or not the \my-repo\ folder is present.
Is my function call syntax correct ?
Executed from the command line, git clone
first creates a local dir folder to clone into.
Does libgit2sharp Repository.Clone()
work differently ?