I am trying to clone a repository with the below C# code
try
{
var result = Repository.Clone(remoteUrl, localPath);
}
catch (Exception ex)
{
}
Repository.Clone()
does not return, and there is no thrown exception. Is there anything wrong with the code? Am I missing something?
I know a lot of time has passed since this question was asked, but this is how I do it (in case it is still helpful):
Repository.Clone("https://repository.git", deployerPath, new CloneOptions()
{
BranchName = "branch_to_pull_from",
CredentialsProvider = CredentialsProvider(),
});
The CredentialsProvider method should return a Credentials object via the CredentialsHandler delegate, provided in the LibGit2Sharp.Handlers namespace.
By the way, I'm using LibGit2Sharp version 0.26.1 , in which an exception is actually thrown in this scenario.
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.