8

i have a problem with cloning/pulling some of GIT repositories. Most of repositories work correctly, but biggest one (commit count - we convert our two years old tfs project to GIT repositories) dont work.

Clone error:

git -c filter.lfs.smudge= -c filter.lfs.required=false -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks clone --branch master PROJECTPATHPLACEHOLDER.git C:\Workspace\GIT\PROJECTNAME Cloning into 'C:\Workspace\GIT\PROJECTNAME'... error: RPC failed; curl 56 Recv failure: Connection was reset fatal: error reading section header 'shallow-info'

Pull error:

RPC failed; curl 56 Recv failure: Connection was reset Git failed with a fatal error. error reading section header 'acknowledgments'

I try google possible solution, but none helped (increase http.postbuffer, different versions). I tried diferent version of the GIT (2.21,2.27,2.29), different environment for git (GIT cmd, Microsoft Visual Studio Professional 2019 Version 16.8.0, Sourcetree 3.3.9) with same error output.
We using BitBucket server as a git server. My configuration is laptop, win10 pro, remote over vpn.

I will be glad for any a help. Thanks, Lukáš Vašek

Ps. If there is any ambiguity, ask me for specification.

L.Vasek
  • 143
  • 1
  • 1
  • 8
  • 1
    We had similar issue, we were using some older official BitBucket image from Docker Hub. It wasn't handling the v2 protocol correctly, and we had to downgrade Git on the bitbucket server (2.17.1 worked for us - I'm not sure maybe newer would work too). I don't know what was the actual reason for this. – lpiepiora Nov 20 '21 at 17:59

4 Answers4

10

I solved this same problem using the command:

git clone --depth 20 <repo>

Reference:

https://git-scm.com/docs/shallow

More about this:

git shallow clone (clone --depth) misses remote branches

6

We found the solution for that problem. There was some kind of a filter at VPN firewall (checkPoint), which blocked git http requests sometimes.

L.Vasek
  • 143
  • 1
  • 1
  • 8
  • I had exactly the same issue when cloning behind a WrapSpeed VPN. I solved it by adding the `--depth 30` as Everton did. – smwikipedia Feb 12 '23 at 06:20
2

Considering anything related to shallow info comes from Git 2.18, Q2 2019 (commit 685fbd32916f3e94bc89aa14e8fdce835b06f801), maybe an older Git would ignore that header section entirely.

If not, I would first check if that repository can be cloned in any other environment (meaning on a Linux machine, still accessed through VPN, but local to the company network)


Note this error message can disappear with Git 2.37 (Q3 2022) in some cases:

"git fetch"(man) unnecessarily failed when an unexpected optional section appeared in the output, which has been corrected with Git 2.37 (Q3 2022).

See commit 7709acf (16 May 2022) by Jonathan Tan (jhowtan).
(Merged by Junio C Hamano -- gitster -- in commit 9cf4e0c, 25 May 2022)

fetch-pack: make unexpected peek result non-fatal

Signed-off-by: Jonathan Tan

When a Git server responds to a fetch request, it may send optional sections before the packfile section.
To handle this, the Git client calls packet_reader_peek() (see process_section_header()) in order to see what's next without consuming the line.

However, as implemented, Git errors out whenever what's peeked is not an ordinary line.
This is not only unexpected (here, we only need to know whether the upcoming line is the section header we want) but causes errors to include the name of a section header that is irrelevant to the cause of the error.

For example, at $DAYJOB, we have seen "fatal: error reading section header 'shallow-info'" error messages when none of the repositories involved are shallow.

Therefore, fix this so that the peek returns 1 if the upcoming line is the wanted section header and nothing else.
Because of this change, reader->line may now be NULL later in the function, so update the error message printing code accordingly (expected '%s', received '%s' or expected '%s').

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Depending on the network configuration, cloning over HTTPS may fail with the error: reading section header 'shallow-info'. I had a similar scenario: Bitbucket + Git repository converted from SVN, with a long history.

I managed to clone the repository using SSH. At first, it was hanging. To fix it, I had to reupload the repository after I ran garbage collection:

  • git fsck
  • git gc --prune="0 days"

Cloning over HTTPS was still failing, though.

Kajsa Gauza
  • 1,348
  • 1
  • 12
  • 22