Some authentication issues with SshUserKeyCredentials with libgit2sharp-SSH:
var co = new CloneOptions();
co.CredentialsProvider = (_url, _user, _cred) => new SshUserKeyCredentials { PrivateKey="C:\\path\\to\\private_key" };
Repository.Clone("git@... .repository.git", path, co);
I found that the SshUserKeyCredentials object is scanning the source code, so my first question would be if I could use this object to deploy a key based check from gitlab?
It seems that the object wants any combination of PrivateKey, Username, PublicKey and Passphrase. I am currently using PrivateKey.
The error I end up with is:
{"Failed to start SSH session: Unable to exchange encryption keys"}
If this method should not work, is there an alternative way to use deployment keys to programmatically control git from a C # environment?
source
share