2015-03-02 59 views
0

我在嘗試使用庫libgit2sharp克隆存儲庫時遇到了一些問題。無法設置代理:錯誤的參數libgit2sharp

我得到這個錯誤:

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

我試圖克隆這樣的:

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, 
      } 
     }); 

我試着在libgit2sharp的維基找到在那裏我應該把代理配置,但我沒有找到。

如果有人能幫忙,我將不勝感激。

回答

0

關於代理處理,libgit2和LibGit2Sharp的行爲很像git自己處理代理設置的方式。

那些可以在git的配置存儲(本地,全局系統,...)與下面的項名稱定義...

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

。 ..或通過環境HTTPS_PROXYHTTP_PROXY變量設置。

您可以在實際的libgit2 code中更好地瞭解探測策略。

有關詳細信息,請參閱以下相關問題這個話題: