TeamCity 10: 'git fetch' command failed. session is down

Answered

Hi

 

This is on TeamCity 10 connecting to a git repository on TFS 2015 Update 3 via SSH (uploaded key). It worked (and still works) when connecting via HTTPS using Basic Authentication instead but we'd really like to get away from Basic Authentication. The same issue occurred in 9.1.7 - in fact we updated to TeamCity 10 on the off-chance it would resolve this.

 

I'm able to use the same private key to clone the repository from another machine. Additionally the Test connection feature on the Edit VCS Root page states that the connection is successful.

 

The error in the build log is as follows:

 

[Collecting changes in 1 VCS root] VCS Root details
[VCS Root details] "MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"}

 

Failed to collect changes, error: Error collecting changes for VCS repository '"MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"}'
'git fetch' command failed.
stderr: ssh://syd-tfs01:22/tfs/DefaultCollection/_git/MyProjectNameWeb: session is down
exit code: 1

7 comments
Comment actions Permalink

This is the stacktrace from the UI:


jetbrains.buildServer.vcs.VcsRootVcsException: Error collecting changes for VCS repository '"MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"}'
'git fetch' command failed.
stderr: ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb: session is down
exit code: 1
at jetbrains.buildServer.buildTriggers.vcs.ConnectionStateReporterImpl.reportConnectionFailed(ConnectionStateReporterImpl.java:30)
at jetbrains.buildServer.buildTriggers.vcs.ConnectionStateReporterImpl.reportConnectionFailed(ConnectionStateReporterImpl.java:5)
at jetbrains.buildServer.buildTriggers.vcs.VcsRootChangesLoader$RunLoadChanges.run(VcsRootChangesLoader.java:20)
at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:74)
at jetbrains.buildServer.buildTriggers.vcs.VcsRootChangesLoader.loadChanges(VcsRootChangesLoader.java:72)
at jetbrains.buildServer.vcs.impl.VcsChangesFetcher$LoadChangesForRoot.run(VcsChangesFetcher.java:16)
at jetbrains.buildServer.vcs.impl.VcsChangesSyncFetcher$TaskWithLock.run(VcsChangesSyncFetcher.java:19)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: jetbrains.buildServer.vcs.VcsException: 'git fetch' command failed.
stderr: ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb: session is down
exit code: 1
at jetbrains.buildServer.buildTriggers.vcs.git.CommandLineUtil.getCommandLineError(CommandLineUtil.java:52)
at jetbrains.buildServer.buildTriggers.vcs.git.CommandLineUtil.getCommandLineError(CommandLineUtil.java:35)
at jetbrains.buildServer.buildTriggers.vcs.git.FetchCommandImpl.fetchInSeparateProcess(FetchCommandImpl.java:159)
at jetbrains.buildServer.buildTriggers.vcs.git.FetchCommandImpl.fetch(FetchCommandImpl.java:81)
at jetbrains.buildServer.buildTriggers.vcs.git.CommitLoaderImpl.fetch(CommitLoaderImpl.java:103)
at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy$FetchAllRefs.fetchTrackedRefs(GitCollectChangesPolicy.java:258)
at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy.ensureRepositoryStateLoaded(GitCollectChangesPolicy.java:154)
at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy.ensureRepositoryStateLoadedFor(GitCollectChangesPolicy.java:123)
at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy.collectChanges(GitCollectChangesPolicy.java:79)
at jetbrains.vcs.api.services.collectChanges.CollectRepositoryChangesPolicyFactory$3.collectChanges(CollectRepositoryChangesPolicyFactory.java:2)
at jetbrains.vcs.api.services.collectChanges.CollectChangesServiceProvider$1.collectChanges(CollectChangesServiceProvider.java:8)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges$CollectChangesForCheckoutRules.call(LoadChanges.java:12)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges$CollectChangesForCheckoutRules.call(LoadChanges.java:2)
at jetbrains.buildServer.vcs.VcsOperationProgressProviderImpl.runWithProgress(VcsOperationProgressProviderImpl.java:27)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges.collectChangesWithProgress(LoadChanges.java:18)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges.collectChangesForCheckoutRules(LoadChanges.java:2)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges.collectChangesByCombinedRule(LoadChanges.java:28)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges.collectChanges(LoadChanges.java:25)
at jetbrains.buildServer.buildTriggers.vcs.VcsRootChangesLoader$RunLoadChanges.run(VcsRootChangesLoader.java:15)
... 9 more
jetbrains.buildServer.vcs.VcsException: 'git fetch' command failed.
stderr: ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb: session is down
exit code: 1
at jetbrains.buildServer.buildTriggers.vcs.git.CommandLineUtil.getCommandLineError(CommandLineUtil.java:52)
at jetbrains.buildServer.buildTriggers.vcs.git.CommandLineUtil.getCommandLineError(CommandLineUtil.java:35)
at jetbrains.buildServer.buildTriggers.vcs.git.FetchCommandImpl.fetchInSeparateProcess(FetchCommandImpl.java:159)
at jetbrains.buildServer.buildTriggers.vcs.git.FetchCommandImpl.fetch(FetchCommandImpl.java:81)
at jetbrains.buildServer.buildTriggers.vcs.git.CommitLoaderImpl.fetch(CommitLoaderImpl.java:103)
at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy$FetchAllRefs.fetchTrackedRefs(GitCollectChangesPolicy.java:258)
at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy.ensureRepositoryStateLoaded(GitCollectChangesPolicy.java:154)
at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy.ensureRepositoryStateLoadedFor(GitCollectChangesPolicy.java:123)
at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy.collectChanges(GitCollectChangesPolicy.java:79)
at jetbrains.vcs.api.services.collectChanges.CollectRepositoryChangesPolicyFactory$3.collectChanges(CollectRepositoryChangesPolicyFactory.java:2)
at jetbrains.vcs.api.services.collectChanges.CollectChangesServiceProvider$1.collectChanges(CollectChangesServiceProvider.java:8)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges$CollectChangesForCheckoutRules.call(LoadChanges.java:12)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges$CollectChangesForCheckoutRules.call(LoadChanges.java:2)
at jetbrains.buildServer.vcs.VcsOperationProgressProviderImpl.runWithProgress(VcsOperationProgressProviderImpl.java:27)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges.collectChangesWithProgress(LoadChanges.java:18)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges.collectChangesForCheckoutRules(LoadChanges.java:2)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges.collectChangesByCombinedRule(LoadChanges.java:28)
at jetbrains.buildServer.buildTriggers.vcs.LoadChanges.collectChanges(LoadChanges.java:25)
at jetbrains.buildServer.buildTriggers.vcs.VcsRootChangesLoader$RunLoadChanges.run(VcsRootChangesLoader.java:15)
at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:74)
at jetbrains.buildServer.buildTriggers.vcs.VcsRootChangesLoader.loadChanges(VcsRootChangesLoader.java:72)
at jetbrains.buildServer.vcs.impl.VcsChangesFetcher$LoadChangesForRoot.run(VcsChangesFetcher.java:16)
at jetbrains.buildServer.vcs.impl.VcsChangesSyncFetcher$TaskWithLock.run(VcsChangesSyncFetcher.java:19)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

 

The teamcity-vcs.log file has a similar message, as well as these sort of messages periodically:

[2016-07-29 15:30:11,758] INFO [ical executor 4] - jetbrains.buildServer.VCS - Collecting changes for VCS root "MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"} from state RepositoryState{defaultBranch='refs/heads/master', revisions={refs/heads/master: 9e1b55baacab094a69095e6bc24eea320e69dfb0, and 21 more unchanged branches}} to state RepositoryState{defaultBranch='refs/heads/master', revisions={refs/heads/master: 9e1b55baacab094a69095e6bc24eea320e69dfb0, and 21 more unchanged branches}}
[2016-07-29 15:30:16,567] WARN [ical executor 4] - cs.ConnectionStateReporterImpl - Unable to collect changes for [MyProjectName Web :: CI Build and Unit Test {id=bt2, internal id=bt2}]: jetbrains.buildServer.vcs.VcsRootVcsException: Error collecting changes for VCS repository '"MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"}'
'git fetch' command failed.
stderr: ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb: session is down
exit code: 1
[2016-07-29 15:31:21,717] INFO [ical executor 5] - jetbrains.buildServer.VCS - Collecting changes for VCS root "MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"} from state RepositoryState{defaultBranch='refs/heads/master', revisions={refs/heads/master: 9e1b55baacab094a69095e6bc24eea320e69dfb0, and 21 more unchanged branches}} to state RepositoryState{defaultBranch='refs/heads/master', revisions={refs/heads/master: 9e1b55baacab094a69095e6bc24eea320e69dfb0, and 21 more unchanged branches}}
[2016-07-29 15:31:26,625] WARN [ical executor 5] - cs.ConnectionStateReporterImpl - Unable to collect changes for [MyProjectName Web :: CI Build and Unit Test {id=bt2, internal id=bt2}]: jetbrains.buildServer.vcs.VcsRootVcsException: Error collecting changes for VCS repository '"MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"}'
'git fetch' command failed.
stderr: ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb: session is down
exit code: 1
[2016-07-29 15:32:14,555] INFO [eric executor 2] - jetbrains.buildServer.VCS - Collecting changes for VCS root "MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"} from state RepositoryState{defaultBranch='refs/heads/master', revisions={refs/heads/master: 9e1b55baacab094a69095e6bc24eea320e69dfb0, and 21 more unchanged branches}} to state RepositoryState{defaultBranch='refs/heads/master', revisions={refs/heads/master: 9e1b55baacab094a69095e6bc24eea320e69dfb0, and 21 more unchanged branches}}
[2016-07-29 15:32:19,918] WARN [eric executor 2] - cs.ConnectionStateReporterImpl - Unable to collect changes for [MyProjectName Web :: CI Build and Unit Test {id=bt2, internal id=bt2}]: jetbrains.buildServer.vcs.VcsRootVcsException: Error collecting changes for VCS repository '"MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"}'
'git fetch' command failed.
stderr: ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb: session is down
exit code: 1
[2016-07-29 15:32:19,926] WARN [mal executor 13] - jetbrains.buildServer.VCS - Failed to collect changes for build configuration MyProjectName Web :: CI Build and Unit Test {id=bt2, internal id=bt2}, error: jetbrains.buildServer.vcs.VcsRootVcsException: Error collecting changes for VCS repository '"MyProjectName Web Git" {instance id=25, parent internal id=1, parent id=MyProjectName_Web_Git, description: "ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb#master"}'
'git fetch' command failed.
stderr: ssh://myservername:22/tfs/DefaultCollection/_git/MyProjectNameWeb: session is down
exit code: 1

0
Comment actions Permalink

Hello,

Sorry for delay. Git client requires basic authentication credentials to work. For more details, please see the section: https://confluence.jetbrains.com/display/TCD10/Git#Git-AuthenticatingtoVisualStudioTeamServices.

0
Comment actions Permalink

Hi Alina

 

Thanks for your response. I don't think I understand it though, please clarify.

  1. Why does TeamCity allow an SSH key to be entered for a Git VCS root if it's going to use Git client that apparently only supports basic authentication?
  2. TFS now supports SSH keys for Git authentication - I have tried that separately using command line Git/SourceTree and it worked. TeamCity supports OpenSSH keys for Git authentication as well. It's hard to understand why they would not work together?
0
Comment actions Permalink

I'm in the same boat. I'm able to configure the VCS root and the test authentication works, but when I try to use it on a build I get the error above.

I know the TFS 2015 Update 3 SSH functionality is new but it only seems to have issues with TeamCity. I'd love to get away from basic authentication...

0
Comment actions Permalink

I also am having the same issue. I am trying to connect to visualstudio.com using SSH for authentication. The "Test Connection" works fine but I have not been able to get it to work in a build configuration. 

Does this mean the SSH does not work only with Team Services?

0
Comment actions Permalink

At the moment Git hosted in VSTS does not work with SSH. Here is the related request: https://youtrack.jetbrains.com/issue/TW-47102, please vote/watch it get status updates.

The current workaround is to use HTTPS and username/password authentication.
We are sorry for the inconvenience.

0

Please sign in to leave a comment.