Connection time out:

Trying to get Teamcity to pull down a repository sitting on github. Getting a Connection time out error from teamcity.
Running on version 7.1.1 (24074), windows 2008 server.
Checking out to the server (not the agent).
Using username / password (not ssh).

Teamcity is running under a service account. If I log into the  teamcity server as the same user I can happily grab the repo from  gitbash or from the command line. But Teamcity refuses to connect.

The fact that it works from the command line and not from teamcity makes me wonder if there is a configuration problem with proxy servers and the like, but I am unsure where any .gitconfig files need to be placed, or if I need to put config data into a teamcity config file somewhere.
Can anyone help ?


The configuration looks like this:

Type of VCS: Git
VCS Root Name: Github
General Settings
Fetch URL:     
Push URL:     
Default Branch: master
User Name Style: Author Name and Email
Authentication Method: Password    
User Name:     <git user name>

The stacktrace from teamcity-vcs.log is included here:
jetbrains.buildServer.vcs.VcsException: List remote refs failed: Connection time out:
    at jetbrains.buildServer.buildTriggers.vcs.git.OperationContext.wrapException(
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getRemoteRefs(
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getCurrentState(
    at jetbrains.buildServer.buildTriggers.vcs.git.TestConnectionCommand.checkFetchConnection(
    at jetbrains.buildServer.buildTriggers.vcs.git.TestConnectionCommand.testConnection(
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.testConnection(
    at jetbrains.buildServer.controllers.admin.projects.EditVcsRootsController.doPost(
    at jetbrains.buildServer.controllers.BaseFormXmlController$1.handleRequest(
    at jetbrains.buildServer.controllers.AjaxRequestProcessor.processRequest(
    at jetbrains.buildServer.controllers.BaseFormXmlController.doHandle(
    at jetbrains.buildServer.controllers.BaseController.handleRequestInternal(
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(
    at org.springframework.web.servlet.DispatcherServlet.doService(
    at org.springframework.web.servlet.FrameworkServlet.processRequest(
    at org.springframework.web.servlet.FrameworkServlet.doPost(
    at javax.servlet.http.HttpServlet.service(
    at javax.servlet.http.HttpServlet.service(
    at jetbrains.buildServer.maintenance.TeamCityDispatcherServlet.service(
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    at jetbrains.buildServer.web.ParametersProviderCalculationContextFilter.doFilter(
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    at jetbrains.buildServer.web.DisableSessionIdFromUrlFilter.doFilter(
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    at jetbrains.buildServer.web.DiagnosticFilter.doFilter(
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    at jetbrains.buildServer.web.ResponseFragmentFilter.doFilter(
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    at org.apache.catalina.core.StandardWrapperValve.invoke(
    at org.apache.catalina.core.StandardContextValve.invoke(
    at org.apache.catalina.core.StandardHostValve.invoke(
    at org.apache.catalina.valves.ErrorReportValve.invoke(
    at org.apache.catalina.core.StandardEngineValve.invoke(
    at org.apache.catalina.connector.CoyoteAdapter.service(
    at org.apache.coyote.http11.AbstractHttp11Processor.process(
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$ Source)
    at Source)
Caused by: org.eclipse.jgit.errors.TransportException: cannot open git-upload-pack
    at org.eclipse.jgit.transport.TransportHttp.connect(
    at org.eclipse.jgit.transport.TransportHttp.openFetch(
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getRemoteRefs(
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getRemoteRefs(
    ... 44 more
Caused by: Connection time out:
    at org.eclipse.jgit.util.HttpSupport.response(
    at org.eclipse.jgit.transport.TransportHttp.connect(
    ... 47 more

Comment actions Permalink

I have the exact same problem with TeamCity 8.0.4. Same problem: I can run the test connection successful and manually pull. However, teamcity build agent reported the timeout error.

Comment actions Permalink


My problem isn't quite that. I can run the pull manually from a gitbash shell, but the test connection fails with a timeout. Further investigation shows me that if I detach the VCS root from the build configuration the test connection succeeds, but as soon as it is attached to ANY build configuration (even a completely empty one) the test connection times out.

I don't necessarily object to the timeout (although it makes using git impossible) but some better loggin would be great, as I am sure the timeout is simply a symptom of some other problem.


Comment actions Permalink


I have exactly all the same symptoms, including this:

...further investigation shows me that if I detach the VCS root from the build configuration the test connection succeeds, but as soon as it is attached to ANY build configuration (even a completely empty one) the test connection times out.

The stack trace looks similar.

Have you been able to solve the problem or overcome it in any way?

I am running TeamCity 8.0.4 (build 27616) on Windows 7 machine.


Comment actions Permalink


No, still not fixed. Pretty much given up. Will probably end up doing something like: pull down to a local GIT; configure TFS to read from it; configure teamcity to use the TFS root.

Pretty sucky, huh ?


Comment actions Permalink

We had an issue whereby builds could not run certain commands on CMD when trying to compile the project. Not directly the same result, but what account is the TeamCity service running under and what account can you manually pull the file from Git? Perhaps it would be worth having these the same? It fixed out issue...

Comment actions Permalink

I managed to solve my problem. If you are still interested, here is what I did:

A few words about the environment first:

In my case TeamCity Server and Agents are behind http/https proxy.

When I installed Git on servers, I configured Git to use the proxy:

     $ git config --system http.proxy

I verified that Git works, by pulling manually using Git Bash.

I assumed that when TeamCity executes Git, git configs that contain the proxy settings are applied, but apparently they are not.

To enable TeamCity to use proxy, an environment variable has to be created:


Value: -Dhttp.proxyHost= -Dhttp.proxyPort=80 -Dhttps.proxyHost= -Dhttps.proxyPort=80

Make sure to pay attention to “s” in -Dhttps.proxyHost and -Dhttps.proxyPort. Http and https have different keys.

And of course, put your own proxy IP and ports.

In theory, user environment variable (for the user that runs TeamCity) should be enough, but I have created System-wide variable.

Don’t forget to restart the TeamCity Service, after the variable is added(not sure if whole machine restart is needed).

The proxy setting will be used not only for git, but also for other TeamCity needs

P.S. TeamCity logging could be a bit better, so that the problem could be pinpointed in the first place, and I am still wondering what is the magic with the working VCS root that is not attached to any BuildConfiguration.

Some related discussions:,,


Comment actions Permalink

Absolute champ!  Worked like a charm.



Please sign in to leave a comment.