Visual Studio Online - 版本描述符 无法解决

问题描述 投票:3回答:3

我正在与visual studio online和git合作开展一个项目。

我尝试访问TFS在线网站并打开我正在处理的项目的源代码,我发现这个错误在任何地方都出现了:

TF401175:无法将版本描述符Branch解析为存储库ProjectName中的版本

我无法访问分支,提交,源代码或绝对任何东西。其他团队成员没有问题,它似乎与我的帐户绑定,当我尝试使用我的帐户在另一台设备上打开它时仍然失败。

视觉工作室的所有操作都很好。我可以提交,拉,推等。我只能访问Web Panel。尝试使用谷歌搜索错误,但我发现的只是在MS网站上报告的错误,该网站已关闭,并说问题已修复。似乎不适合我。

git visual-studio tfs azure-devops
3个回答
4
投票

您的默认分支已被删除。

您需要将默认分支更改为存在的分支。尝试使用不可用的分支选择器,尝试将#path=%2F&version=GBmaster&_a=contents附加到默认“代码”URL的末尾。


3
投票

我得到了同样的错误。 在我的情况下,我的本地分支尚未同步到服务器,因此在我的Web浏览器中,Pull-Request在服务器上(vsts),但我的分支不是。 解决它:我在VS中进行了同步,推送了我的本地分支,然后它工作了:我在浏览器中刷新了Pull Request,然后错误消失了。


0
投票

在我的情况下,我试图获取文件内容,并最终得到相同的错误。

TF401174:在“分支:”指定的版本的存储库“存储库”中找不到项“项”(已解析为提交'commit')'

我试图从VisualStudioOnline库(Microsoft.VisualStudio.Services.Client,Microsoft.TeamFoundationServer.Client)创建

VssBasicCredential credintials = new VssBasicCredential(String.Empty, "YOUR SECRET CODE HERE");
VssConnection connection = new VssConnection(new Uri("https://yourserverurl.visualstudio.com/"), credintials);
GitHttpClient client = connection.GetClient<GitHttpClient>();

List<GitRepository> repositories = await client.GetRepositoriesAsync(true); // or use GetRepositoryAsync()
var repo = repositories.FirstOrDefault(r => r.Name == "Some.Repo.Name");

GitVersionDescriptor descriptor = new GitVersionDescriptor()
{
    VersionType = GitVersionType.Branch,
    Version = "develop",
    VersionOptions = GitVersionOptions.None
};

List<GitItem> items = await client.GetItemsAsync(repo.Id, scopePath: "/", recursionLevel: VersionControlRecursionType.Full, versionDescriptor: descriptor);

然后,如果您将直接尝试获取项目client.GetItemTextAsync(repo.Id, item.Path)的内容,则在分支不是默认值时,您将收到此类错误。再次提供GitVersionDescriptior。

GitVersionDescriptor commitDescriptior = new GitVersionDescriptor()
{
    VersionType = GitVersionType.Commit,
    Version = item.CommitId,
    VersionOptions = GitVersionOptions.None
};

Stream stream = await client.GetItemTextAsync(repo.Id, item.Path, download: true, versionDescriptor: commitDescriptior)
© www.soinside.com 2019 - 2024. All rights reserved.