I'm using LibGit2Sharp-ssh library for clone repository.
string repositoryUrl = "ssh://[email protected]/project-name/repo-name.git";
LibGit2Sharp.Repository.Clone(repositoryUrl, localPath, new LibGit2Sharp.CloneOptions { CredentialsProvider = MyCredentialsProvider });
private Credentials MyCredentialsProvider(string url, string usernameFromUrl, SupportedCredentialTypes types)
{
var sshDir = Directory.GetCurrentDirectory();
return new LibGit2Sharp.SshUserKeyCredentials()
{
Username = usernameFromUrl,
Passphrase = string.Empty,
PublicKey = Path.Combine(sshDir, "id_rsa.pub"),
PrivateKey = Path.Combine(sshDir, "private_key.pem"),
};
}
But getting error Unable to load shared library 'git2-ssh-baa87df' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libgit2-ssh-baa87df, 0x0001): tried: 'libgit2-ssh-baa87df' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibgit2-ssh-baa87df' (no such file), '/usr/lib/libgit2-ssh-baa87df' (no such file, not in dyld cache), 'libgit2-ssh-baa87df' (no such file), '/usr/local/lib/libgit2-ssh-baa87df' (no such file), '/usr/lib/libgit2-ssh-baa87df' (no such file, not in dyld cache)
How to fix it?
My OS is mac and i'm using .net 6. I already tryed to copy libgit2-ssh-baa87df library to debug and /usr/local/lib folders. But it doesn't help.