git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] clone of large repo fails when server closes idle SSH session during "Resolving deltas"

From
GPGreg Pflaum <greg.pflaum@pnp-hcl.com>
Date
May 19, 2021, 03:46 UTC
Message-ID
<OF9ECB0D17.7C6A7258-ON852586DA.0014125E-852586DA.0014B7AB@pnp-hcl.com>

Git's handling of the SSH session during "git clone" changed between Git 2.17.0 and 2.31.1, causing cloning of a large repo to fail when the server closes the idle session during the "Resolving deltas" phase.

In the older version, git closes the SSH session after "Receiving objects" and before "Resolving deltas". In the newer version, git doesn't close the SSH session until after "Resolving deltas" finishes. In the newer version, if "Resolving deltas" takes a long time (over 2 minutes for our large repo) and the server closes the idle SSH session (60 seconds for our GitHub Enterprise server), git displays the error message "Connection to git.example.com closed by remote host", finishes resolving deltas, then exits without checking out files.

Successful with Git 2.17.0:
> git clone git@git.example.com:org/bigrepo.git

Cloning into 'bigrepo'... remote: Enumerating objects: 260, done. remote: Counting objects: 100% (260/260), done. remote: Compressing objects: 100% (170/170), done. remote: Total 361839 (delta 74), reused 174 (delta 37), pack-reused 361579 Receiving objects: 100% (361839/361839), 4.47 GiB | 36.71 MiB/s, done. Resolving deltas: 100% (252249/252249), done. Checking out files: 100% (59466/59466), done.

Fails with Git 2.31.1:

git clone git@git.example.com:org/bigrepo.git Cloning into 'bigrepo'... remote: Enumerating objects: 363, done. remote: Counting objects: 100% (363/363), done. remote: Compressing objects: 100% (221/221), done. Receiving objects: 100% (361930/361930), 4.47 GiB | 36.37 MiB/s, done. RConnection to git.example.com closed by remote host.esolving deltas: 39% (98729/252244) Resolving deltas: 100% (252244/252244), done.

What did you do before the bug happened? (Steps to reproduce your issue)
Ran "git clone git@git.example.com:org/bigrepo.git"
What did you expect to happen? (Expected behavior)
Expected successful creation of a cloned repo.
What happened instead? (Actual behavior)

Repo was partially created, but files were not checked out. Branches and tags also seem to be missing from the repo.

What's different between what you expected and what actually happened?

With the old Git version, cloning the repo is successful. With the newer version it fails.

Anything else you want to add:

A workaround is to configure the SSH client to prevent the server from seeing an idle session, by adding these lines to .ssh/config:

Host git.example.com
    # Send keep-alive message to server every 30 seconds
    # so the server won't close an idle session.
    ServerAliveInterval 30

[System Info] git version: git version 2.31.1.windows.1 cpu: x86_64 built from commit: c5f0be26a7e3846e3b6268d1c6c4800d838c6bbb sizeof-long: 4 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Windows 10.0 14393 compiler info: gnuc: 10.2 libc info: no libc information available $SHELL (typically, interactive shell): <unset>

[Enabled Hooks] not run from a git repository - no hooks to show

Next: Jeff King
Message 1 of 4 in “[BUG] clone of large repo fails when server closes idle SSH session during "Resolving deltas"”
  1. Greg PflaumMay 19, 2021
  2. Jeff KingMay 19, 2021
  3. Jeff KingMay 19, 2021
  4. fetch-pack: signal v2 server that we are done making requestsJeff King, May 19, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.