Connection time out: github.com

Hi,
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 ?

Cheers,
Luke

The configuration looks like this:



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



The stacktrace from teamcity-vcs.log is included here:
jetbrains.buildServer.vcs.VcsException: List remote refs failed: java.net.ConnectException: Connection time out: github.com
    at jetbrains.buildServer.buildTriggers.vcs.git.OperationContext.wrapException(OperationContext.java:134)
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getRemoteRefs(GitVcsSupport.java:505)
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getCurrentState(GitVcsSupport.java:128)
    at jetbrains.buildServer.buildTriggers.vcs.git.TestConnectionCommand.checkFetchConnection(TestConnectionCommand.java:100)
    at jetbrains.buildServer.buildTriggers.vcs.git.TestConnectionCommand.testConnection(TestConnectionCommand.java:68)
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.testConnection(GitVcsSupport.java:417)
    at jetbrains.buildServer.controllers.admin.projects.EditVcsRootsController.doPost(EditVcsRootsController.java:90)
    at jetbrains.buildServer.controllers.BaseFormXmlController$1.handleRequest(BaseFormXmlController.java:54)
    at jetbrains.buildServer.controllers.AjaxRequestProcessor.processRequest(AjaxRequestProcessor.java:45)
    at jetbrains.buildServer.controllers.BaseFormXmlController.doHandle(BaseFormXmlController.java:52)
    at jetbrains.buildServer.controllers.BaseController.handleRequestInternal(BaseController.java:73)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at jetbrains.buildServer.maintenance.TeamCityDispatcherServlet.service(TeamCityDispatcherServlet.java:12)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at jetbrains.buildServer.web.ParametersProviderCalculationContextFilter.doFilter(ParametersProviderCalculationContextFilter.java:2)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at jetbrains.buildServer.web.DisableSessionIdFromUrlFilter.doFilter(DisableSessionIdFromUrlFilter.java:6)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at jetbrains.buildServer.web.DiagnosticFilter.doFilter(DiagnosticFilter.java:21)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at jetbrains.buildServer.web.ResponseFragmentFilter.doFilter(ResponseFragmentFilter.java:15)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.jgit.errors.TransportException: https://github_user@github.com/organisation/github_repo_name.git: cannot open git-upload-pack
    at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:466)
    at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:276)
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getRemoteRefs(GitVcsSupport.java:523)
    at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getRemoteRefs(GitVcsSupport.java:503)
    ... 44 more
Caused by: java.net.ConnectException: Connection time out: github.com
    at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:173)
    at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:429)
    ... 47 more

7 comments

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.

0

Hi,

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.

/Luke

0

Luke,

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.

-Artem

0

Hi,

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 ?

/Luke

0

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...

0

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 192.168.0.1:80

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:

Name: TEAMCITY_SERVER_OPTS

Value: -Dhttp.proxyHost=192.168.0.1 -Dhttp.proxyPort=80 -Dhttps.proxyHost=192.168.0.1 -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:http://youtrack.jetbrains.com/issue/TW-12363, http://youtrack.jetbrains.com/issue/TW-24434,

env_var.PNG

0

Absolute champ!  Worked like a charm.

Cheers,
Luke

0

Please sign in to leave a comment.