I have a TFS 2017 server build, it is linked to a bit bucket\Git repo. The build is set to automatically kickoff when master changes. This works fine and also works fine if i manually kick off a build of master or a branch.
But i keep getting thse failed build that randomly kick off by Project Collection Service Accounts
They always fail with this error
An exception occurred while polling the repository. Error: Microsoft.TeamFoundation.Build2.Server.Extensions.ExternalConnectorException: this remote has never connected ---> LibGit2Sharp.LibGit2SharpException: this remote has never connected 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 Microsoft.TeamFoundation.Build2.Server.Extensions.GitConnector.GetBranches(ExternalConnection connection) --- End of inner exception stack trace --- at Microsoft.TeamFoundation.Build2.Server.Extensions.GitConnector.GetBranches(ExternalConnection connection) at Microsoft.TeamFoundation.Build2.Server.Extensions.GitSourceProvider.GetMatchingBranchRefs(IVssRequestContext requestContext, BuildDefinition definition, IList
1 branchFilters) at Microsoft.TeamFoundation.Build2.Server.Extensions.GitSourceProvider.GetSourceVersionsToBuild(IVssRequestContext requestContext, BuildDefinition definition, List
1 branchFilters, Boolean batchChanges, String previousVersionEvaluated, Dictionary`2& ciData, String& lastVersionEvaluated) at Microsoft.TeamFoundation.Build2.Server.Extensions.BuildPollingJobExtension.Run(IVssRequestContext requestContext, TeamFoundationJobDefinition jobDefinition, DateTime queueTime, String& resultMessage).
These fails are always Individual Continuous Integration
But when i check into master which is the same user Project Collection Service Accounts it uses Batched Continuous Integration not sure if this makes a difference. This is happening on all my build definitions but only since i upgrade to TFS 2017, this did not happen on my previous version
This was resolved by adding the Project Collection Service Accounts as a member of the endpoint administrators
According to the error info:
This is a connection failing issue and since you have upgraded your TFS Server. You could give try to update the credentials of the External Git Service endpoint. (Delete the old one and create a new one) which may to the trick.
Beside if you are using TFS2017.1, you could also use another option for integrating TFS with Bitbucket-- One-Time import of source code form Bitbucket This is something very comfortable because you don’t have to worry about integration at all if you just use whatever TFS brings out of the box.