Larsi
Larsi

Reputation: 4774

Unable to connect GitHub enterprise into TFS 2017

We would like to connect TFS2017 to out GitHub for Enterprise.

We get an error when we try to clone. The error occurs in "Get sources" step (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 (on the TFS server) we're able to clone using powershell, and executing a script in a build step let us verify that the same proxy settings are used.

Below are some more debug from the _diag folder

    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

Any idea how to debug this, or what we might try?

Upvotes: 0

Views: 682

Answers (1)

Ben_G
Ben_G

Reputation: 826

According to this page you can't connect to Github Enterprise using TFS 2017. Please let me know if this has changed as I'd love to be able to do this!

Upvotes: 1

Related Questions