Problems with SSH Connection to BitBucket: failing when VCS root attached to a build configuration

To get my team's BitBucket account details out of our CI system (TeamCity!), I'm trying to configure TeamCity to use an SSH Deployment Key. I've created a new build configuration inside the existing project in order to run some preliminary tests. I've created a new SSH key and uploaded it successfully to both (1) the target BitBucket repository and (2) the TeamCity project containing my new build configuration.

  1. First I created a new VCS root at the Project level with the settings below*. When I test the settings, I get "Connection successful!".
  2. Then I attach the VCS root to my new build configuration. Now when I test the VCS connection, I get this error: "List remote refs failed: com.jcraft.jsch.JSchException: Connection timed out: connect"

If I detach the VCS root from the build configuration, the connection tests as 'successful' again.
I've attached the TeamCity stacktrace and am looking into it, but insights are most appreciated!

-- flag

* the VCS settings

  • Fetch URL:{my team account name}/{the private reposiroty name}.git
  • Authentication method: Uploaded Key
  • Uploaded Key: {the TC project's SSH key is selected}

Comment actions Permalink

Any solutions? Having the same issue here...

Comment actions Permalink



there is not a "general" solution for this issue. Connection issues can happen for a varied number of reasons, local machine or remote server. It's not impossible that a cache for the build configuration is making the connection misbehave. Removing the older cache would probably help in this case, but it's hard to point out.


Of course, make sure that if you have parametrized your VCS Root, the parameters aren't altered in the build configuration to incorrect values.


Also make sure to be using the latest release of TeamCity, as there might have been upgrades that fix some possible issues.

Comment actions Permalink

I had the same issue but added the git@ prefix to all urls and regenerated the id...then it worked.


Please sign in to leave a comment.