开发者

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

开发者 https://www.devze.com 2023-03-26 12:32 出处:网络
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 O

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 开发者_StackOverflowthe 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?


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.


I have not used team city, but i have used GO (from thoughtworks) for continuous integration, where i faced similar problem.

Can you check the environment variable-path for the user which is running the task on the build agent. If you are using msysgit, both the bin and cmd folder from msysgit should be in the path.


It happens when you have huge repo. You can follow next recommendation:

Increase the timeout in user machine for OSX or Linux:

  1. Create ~/.ssh/config file (if it doesn't exist yet)
  2. Add SSH ServerAliveInterval ServerAliveCountMax settings into the file, eg:

Host *
 ServerAliveInterval 86400
 ServerAliveCountMax 4

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号