使用libgit2sharp对远程TFS git存储库进行错误身份验证

时间:2019-03-18 19:01:06

标签: c# vb.net git tfs libgit2sharp

我正在尝试使用libgit2sharp列出TFS中托管的远程git存储库的分支。

我似乎遇到了身份验证问题;我的本地计算机具有此git repo的凭据存储在Credential Manager中,并且我可以通过Powershell和Visual Studio连接到它。我正在每个this thread使用DefaultCredentials()。

下面是我试图用来列出远程分支的代码(为了匿名起见,我已经用括号中的通用名称替换了一些url):

Repository.ListRemoteReferences("http://{serverName}:{port}/tfs/Development/_git/{projectName}",
                                           New Handlers.CredentialsHandler(Function(_url, _user, _cred) New DefaultCredentials())) _
                     .Where(Function(x) x.IsLocalBranch) _
                     .Select(Function(x) x.CanonicalName).ToList()

运行此代码时出现以下错误(根据this thread,该错误消息与无效的凭据有关):

Error: this remote has never connected
Inner Exception:    N/A
Source: LibGit2Sharp
Stack Trace: at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) 
    at LibGit2Sharp.Core.Proxy.git_remote_ls(Repository repository, RemoteHandle remote) at LibGit2Sharp.Repository.ListRemoteReferences(String url, CredentialsHandler credentialsProvider) 
    at Composer.Web.ConfigurationTools.EditAzureEnvironment.GetMobileGitBranches() in C:\TFS2010\DiamondComposer\Code\Development\DiamondComposer\ASPNET\ConfigurationTools\DaaP\EditAzureEnvironment.ascx.vb:line 289

0 个答案:

没有答案
相关问题