无法将GitHub企业连接到TFS 2017

时间:2016-11-23 09:10:39

标签: tfs azure-devops github-enterprise tfs2017

我们希望将TFS2017连接到GitHub for Enterprise。

  • 向“外部Git”添加了新的服务端点
  • 使用我的用户名和个人访问令牌配置它
  • 添加了新的构建定义
  • 选择的外部git和刚刚配置的服务
  • 输入存储库的名称(没有下拉列表,尝试了各种格式,包括完整版 https://ghe.mycompany.com/myUsername/myTestRepository.git
  • 触发新版

我们尝试克隆时遇到错误。 “获取源”步骤(1_Get_sources.txt)

中发生错误
2016-11-21T13:31:20.4836373Z Syncing repository: https://ghe.mycompany.com/********/myTestRepository.git (Git)
2016-11-21T13:31:20.5326404Z Starting clone
2016-11-21T13:31:21.0286690Z ##[error]LibGit2Sharp.LibGit2SharpException: Request failed with status code: 404
2016-11-21T13:31:21.0296729Z ##[error]   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
2016-11-21T13:31:21.0306726Z ##[error]   at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)
2016-11-21T13:31:21.0316723Z ##[error]   at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
2016-11-21T13:31:21.0336678Z ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.CloneRepository(String repositoryPath, Uri repositoryUrl, Boolean checkoutSubmodules, String username, String password)
2016-11-21T13:31:21.0346735Z ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncRepository(Uri repositoryUrl, String rootPath, Boolean cleanRepository, Boolean checkoutSubmodules, String sourceVersion, String username, String password)
2016-11-21T13:31:21.0356736Z ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncRepository(ITaskEndpoint endpoint, String rootPath, Boolean cleanRepository, Boolean checkoutSubmodules, String sourceVersion)
2016-11-21T13:31:21.0366732Z ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)
2016-11-21T13:31:21.0376729Z ##[error]   at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()

Localy(在TFS服务器上)我们可以使用powershell进行克隆,并在构建步骤中执行脚本,让我们验证是否使用了相同的代理设置。

以下是_diag文件夹中的一些调试

    11:35:23.072987 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = Syncing repository: https://ghe.mycompany.com/********/myTestRepository.git (Git))
11:35:23.076124 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = repository url=https://ghe.mycompany.com/api/v3)
11:35:23.078235 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = checkoutSubmodules=False)
11:35:23.087627 Syncing and checking out sources.
11:35:23.087627 rootPath=C:\TfsBuildAgents\Agent-smi-build01\_work\22\s
11:35:23.087627 cleanRepository=True
11:35:23.087627 sourceBranch=master
11:35:23.087627 sourceVersion=
11:35:23.088628 sourcesToBuild=refs/remotes/origin/master
11:35:23.092875 Checking if the repo on disk matches the expected repository URL.
11:35:23.092875 gitRepoFolder=C:\TfsBuildAgents\Agent-smi-build01\_work\22\s
11:35:23.092875 expectedRepositoryUrl=https://ghe.mycompany.com/api/v3
11:35:23.120701 Unable to determine whether the existing repo matches. Suppressing the exception and treating the repo as if it doesn't match. For verbose purposes only, the exception is: LibGit2Sharp.RepositoryNotFoundException: Path 'C:\TfsBuildAgents\Agent-smi-build01\_work\22\s' doesn't point at a valid Git repository or workdir.
   at LibGit2Sharp.Core.Proxy.git_repository_open(String path)
   at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)
   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.IsExpectedRepository(String gitRepoFolder, Uri expectedRepositoryUrl)
11:35:23.127765 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = Starting clone)
11:35:23.133909 Process logging event with task handler.
11:35:23.613344 ---------------------------------------------------------------------------
11:35:23.615482 LibGit2Sharp.LibGit2SharpException: Request failed with status code: 404

11:35:23.615482    at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)

11:35:23.615482    at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)

11:35:23.615482    at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)

11:35:23.615482    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.CloneRepository(String repositoryPath, Uri repositoryUrl, Boolean checkoutSubmodules, String username, String password)

11:35:23.615482    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncRepository(Uri repositoryUrl, String rootPath, Boolean cleanRepository, Boolean checkoutSubmodules, String sourceVersion, String username, String password)

11:35:23.616553    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncRepository(ITaskEndpoint endpoint, String rootPath, Boolean cleanRepository, Boolean checkoutSubmodules, String sourceVersion)

11:35:23.616553    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)

11:35:23.616553    at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
11:35:23.616553    at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)

11:35:23.616553    at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)

11:35:23.616553    at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)

11:35:23.616553    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.CloneRepository(String repositoryPath, Uri repositoryUrl, Boolean checkoutSubmodules, String username, String password)

11:35:23.616553    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncRepository(Uri repositoryUrl, String rootPath, Boolean cleanRepository, Boolean checkoutSubmodules, String sourceVersion, String username, String password)

11:35:23.616553    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncRepository(ITaskEndpoint endpoint, String rootPath, Boolean cleanRepository, Boolean checkoutSubmodules, String sourceVersion)

11:35:23.616553    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)

11:35:23.616553    at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
11:35:23.617555 ---------------------------------------------------------------------------
11:35:23.618654 Process logging event with task handler.
11:35:23.623821 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]LibGit2Sharp.LibGit2SharpException: Request failed with status code: 404)
11:35:23.624910 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result))
11:35:23.625909 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]   at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts))
11:35:23.626974 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]   at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options))
11:35:23.627973 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.CloneRepository(String repositoryPath, Uri repositoryUrl, Boolean checkoutSubmodules, String username, String password))
11:35:23.629042 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncRepository(Uri repositoryUrl, String rootPath, Boolean cleanRepository, Boolean checkoutSubmodules, String sourceVersion, String username, String password))
11:35:23.630112 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncRepository(ITaskEndpoint endpoint, String rootPath, Boolean cleanRepository, Boolean checkoutSubmodules, String sourceVersion))
11:35:23.631180 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken))
11:35:23.632188 BaseLogger.LogConsoleMessage(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, message = ##[error]   at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0())
11:35:23.634183 Process logging event with task handler.
11:35:23.638350 BaseLogger.LogStatus(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, scope.TimelineRecordId = 2fd7ca75-f01d-4906-bf39-7c8d66a1df7f, record.Name = )
11:35:23.649716 BaseLogger.LogAttachment(scope.JobId = af970025-e4bc-4692-a708-bbe734745370, type = DistributedTask.Core.Log, name = Get sources, path = C:\TfsBuildAgents\Agent-smi-build01\_diag\w7ac045c8-3285-4be2-b993-b542da560c11.log)
11:35:23.658368 ---------------------------------------------------------------------------
11:35:23.660442 System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException: Prepare repository failed with exception. ---> LibGit2Sharp.LibGit2SharpException: Request failed with status code: 404

知道如何调试这个,或者我们可能会尝试什么?

1 个答案:

答案 0 :(得分:1)

根据this页面,您无法使用TFS 2017连接到Github Enterprise。如果我已经改变了,请告诉我,因为我希望能够做到这一点!