Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve a timeout exception when TeamCity fetches changes from a SSH Git repository

I've moved a Git repository from a shared folder on the network to a SSH server running gitolite. I've added a public/private key for TeamCity to use and pointed the VCS root at it. This all works OK as Test Connection is successful and my build configuration shows the pending changes.

However, when TeamCity attempts to fetch those pending changes I get the following error:

'git fetch' command failed.
exception: Timeout exception

Switching to verbose logging I see that it timed out after 90 seconds - I would expect under normal circumstances that it would be a matter of a couple of seconds to fetch these changes.

Since I started trying to troubleshoot the problem I have changed my VCS root to "Default Private Key" and added the required .ssh folder with config, id_rsa and known_hosts files. I saw the fingerprint and then password messages in the log until I put the necessary stuff in these files, and now my server is back to giving the Timeout exception again just as it does when I specify the key in the VCS root.

If I run Git from the command line I am able to clone the repository without any prompts (when I have the .ssh folder set up as above). This is from a different user account as TC is running as a service under the default SYSTEM account, but I don't think that's the cause because as I said I can see that TC has picked up the changes to the .ssh folder for that account.

What could be wrong?

like image 783
GraemeF Avatar asked Aug 08 '11 16:08

GraemeF


1 Answers

You have setup the keys for the TeamCity server, but have you done it for the agent as well? That would explain why in the configuration the test connection works, but it doesn't work when the agent is executing.

Quick way to debug the issue:

In the VCS settings, change VCS Checkout mode to Automatically on server and see if it works?

Update:

Can you login to the TeamCity server and run a manula git clone from your git repo as teamcity user? This way you can see it working and also save as trusted hosts etc.

like image 54
manojlds Avatar answered Sep 22 '22 15:09

manojlds