Failed To set Proxy: Wrong parameter libgit2sharp

老子叫甜甜 提交于 2019-12-13 07:02:37

问题


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

I'm getting 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 wiki of libgit2sharp where i should put the proxy config, but i didn't found.

I will be grateful if someone can help.


回答1:


Regarding proxy handling, libgit2 and thus LibGit2Sharp behave a lot like the way git itself handles proxy settings.

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

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

...or set through the environment HTTPS_PROXY or HTTP_PROXY variables.

You can get a better insight about the probing strategy in the actual libgit2 code.

For more detailed information, see the following relevant issues about this topic:

  • Proposal to leverage Windows Proxy Auto Discovery
  • Using a proxy url with credentials


来源:https://stackoverflow.com/questions/28810372/failed-to-set-proxy-wrong-parameter-libgit2sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!