'git fetch' command failed. stderr: Socket Closed

We have been working for several weeks with git as version control system.

I have set up integration with TeamCity and that has been working fine.

We have four different projects that use git

Yesterday afternoon one of the projects stopped working.

The build fails to start. The message "Failed to start build #1094 on Teamcityagent8_Continuous5 (and 1 more)" is shown in red.

The build log says very little. Just

[16:12:46]Checking for changes

[16:12:49]Failed to start build

[16:12:49]Failed to collect changes, error: Error collecting changes for VCS repository 'http://foo-app-sprint:7990/scm/BAR/qux.git#master'

'git fetch' command failed.

stderr: Socket Closed

[16:12:49]Cannot calculate build metric 'percent of class coverage' - no value

Strangely the other projects that have very similar configuration all work just fine. They use the same build agents.

We use Atlassian Stash as Git server. I have looked at all the logs there, and nothing at all happens when I force a run in team city. So, it would seem that TeamCity does not even reach the Git server.

If I test the VCS connection in TeamCity it works.

I have tested restarting Stash. It did not help.

We are working with feature branches. But I have tested turning those of and it did not help.

Today the build has actually worked a couple of times, but the problem returns. The problem now also occurrs intermittently on another one of our projects.



sorry for delay. I suspect that the error comes from Stash, it seems like it closes connection for some reason. Please check Stash logs, do they contain something regarding this error?


Nothing at all happens in the Stash logs at the time when the error occurs.
Nothing at all happens in the event logs of the machine running Stash.
That to me indicates that the call does not reach the Stash machine - the socket communication is never successfully begun.

But, sure, I will look even closer at the Stash logs.


Ok, let's also dig deeper into TeamCity. Please enable 'debug-vcs' logging preset at Administration > Diagnostics, reproduce the problem and attach teamcity-vcs.log here or send it to teamcity-feedback@jetbrains.com with a link to this thread.


I have looked through the Stash logs very carefully. There are no errors reported at all. There are a few warnings, but they do not seem relevant.

I get a total of three warnings.

  1. This one, which Atlassian specifically states you can ignore.
  2. This one, which I have now reported to Atlassian, but it seems completely irrelevant.
  3. This one, which I have now reported to Atlassian. It also seems irrelevant to me.

None of the warnings occur at a time close to the time when we get the 'git fetch' error.

Atlassian have now replied concerning the two warnings I reported and those warnings can indeed be ignored.


OK, please send us teamcity-vcs.log.


OK, I have sent it to you.


Hi Klas, did you ever get a resolution to this problem? We are having the exact same issue with TeamCity and Git


Hi Tim,

please attach teamcity-server.log and teamcity-vcs.log debug logs here or send them to teamcity-feedback@jetbrains.com.


No, we never resolved this problem.
I also posted a question about this on the Atlassian Site.

We tried fixing the issue for a couple of weeks, then we abandoned Atlassian Stash.


Thanks for getting back to me Klas, we are using GitStack rather than Stash. If you don't mind me asking, what did you move to instead of Stash, and are you still using TeamCity to monitor Git repositories?


We actually replaced Stash with a simple file based repo on a UNC share (we are a Windows shop)
This has worked surprisingly well. There have been no issues at all. Concurrency is not a problem. Performance has not been a problem.
The file based security fits us perfectly. It is (obviously) AD-based, which is just what we want. No SSH keys necessary.
It is pretty much zero maintenance. And no installation, since there is no server process at all.


We have exact same issue. Pulling source from stash does not work while pulling source from TFS Git repo works perfectly fine. Logs or error messages do not suggest anything useful. There is a rumor going that it may be something to do with "group policies" (whatever that means).


Hi Gustas,

Could you please create a bug report in our tracker? Please attach teamcity-server.log and teamcity-vcs.log debug logs.


Please sign in to leave a comment.