Failed to install proxy: invalid libgit2sharp parameter

I am having some problems when I try to clone a repository using the libgit2sharp library.

I get this error:

A first chance exception of type 'LibGit2Sharp.LibGit2SharpException' occurred in LibGit2Sharp.dll Additional information: Failed to set proxy: Wrong parameter. 

I'm trying to clone like this:

 var gitServerUri = new Uri(Settings.Default.GitServerUrl); var cred = Git.Credentials.Get(gitServerUri.Host); string clonedRepoPath = Repository.Clone(project.GitUrl(),projectLocalPath, new CloneOptions() { CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials { Username = cred.Login, Password = cred.Password, } }); 

I tried to find in the wiki libgit2sharp where I have to put the proxy configuration, but I did not find.

I would appreciate it if someone could help.

0
source share
1 answer

As for proxy processing, libgit2 and therefore LibGit2Sharp behave the same way git itself handles proxy settings.

Those can be defined in git configuration repositories (local, global, system, ...) with the following entry names ...

  • remote.<remote_name>.proxy
  • http.proxy

... or set the environment variables HTTPS_PROXY or HTTPS_PROXY .

You can get a better idea of ​​the probing strategy in the actual libgit2 code .

For more information, see the following relevant questions on this topic:

0
source

Source: https://habr.com/ru/post/1257826/


All Articles