我使用libgit2sharp-ssh
并且我成功实现了 ssh 连接,但现在https/http
连接在代理下不起作用?我查看了libgit2sharp-ssh
lib 中 clone 和 Push 方法的实现,它们的值ProxyOptions
都是:
ProxyOptions = new GitProxyOptions { Version = 1 }
public virtual void Push(Remote remote, IEnumerable<string> pushRefSpecs, PushOptions pushOptions)
{
Ensure.ArgumentNotNull(remote, "remote");
Ensure.ArgumentNotNull(pushRefSpecs, "pushRefSpecs");
// Return early if there is nothing to push.
if (!pushRefSpecs.Any())
{
return;
}
if (pushOptions == null)
{
pushOptions = new PushOptions();
}
// Load the remote.
using (RemoteHandle remoteHandle = Proxy.git_remote_lookup(repository.Handle, remote.Name, true))
{
var callbacks = new RemoteCallbacks(pushOptions);
GitRemoteCallbacks gitCallbacks = callbacks.GenerateCallbacks();
Proxy.git_remote_push(remoteHandle,
pushRefSpecs,
new GitPushOptions()
{
PackbuilderDegreeOfParallelism = pushOptions.PackbuilderDegreeOfParallelism,
RemoteCallbacks = gitCallbacks,
ProxyOptions = new GitProxyOptions { Version = 1 },
});
}
}
internal enum GitProxyType
{
None,
Auto,
Specified
}
[StructLayout(LayoutKind.Sequential)]
internal struct GitProxyOptions
{
public uint Version;
public GitProxyType Type;
public IntPtr Url;
public IntPtr CredentialsCb;
public IntPtr CertificateCheck;
public IntPtr CbPayload;
}
}
使用与 git 的连接时libgit2sharp-ssh
不支持使用代理?http/s
(因为在没有实现 ssh 的情况下使用 libgit2sharp 可以很好地使用代理)