Issues with cloning a repo from Windows using latest git

Hello, I’m facing an issue and I really don’t have a clue how to proceed.
From my perspective the problem is somewhere in git for Windows or incompatibility between git on Windows and Gitlab, but I’m just guessing.
Let see the facts:

PS E:\Git> git clone git@github.com:KpuCko/docker.git
Cloning into 'docker'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 12 (delta 2), reused 8 (delta 1), pack-reused 0
Receiving objects: 100% (12/12), done.
Resolving deltas: 100% (2/2), done.
PS E:\Git> git clone git@gitlab.home.lan:administration/etckeeper.git
Cloning into 'etckeeper'...
remote: Enumerating objects: 1938, done.
remote: Counting objects: 100% (271/271), done.
remote: Compressing objects: 100% (186/186), done.
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
PS E:\Git> git version
git version 2.33.0.windows.2
PS E:\Git>

But if I do the same (with older version of git on Linux) there is no problem, let me show you:

root@puppet.home.lan:/tmp# git clone git@gitlab.home.lan:administration/puppet.git
Cloning into 'puppet'...
remote: Enumerating objects: 2555, done.
remote: Counting objects: 100% (351/351), done.
remote: Compressing objects: 100% (267/267), done.
remote: Total 2555 (delta 58), reused 234 (delta 34), pack-reused 2204
Receiving objects: 100% (2555/2555), 1.88 MiB | 23.49 MiB/s, done.
Resolving deltas: 100% (391/391), done.
root@puppet.home.lan:/tmp#
root@puppet.home.lan:/tmp# git version
git version 2.25.1
root@puppet.home.lan:/tmp#

Ok, I will assume you will ask me to try with the same version, but I already did it.

PS E:\Git> cd 'D:\Apps\Git 2.20.1\'
PS D:\Apps\Git 2.20.1> .\git-cmd.exe

D:\Apps\Git 2.20.1>git version
git version 2.20.1.windows.1

D:\Apps\Git 2.20.1>git clone git@gitlab.home.lan:administration/etckeeper.git
Cloning into 'etckeeper'...
remote: Enumerating objects: 1938, done.
remote: Counting objects: 100% (271/271), done.
remote: Compressing objects: 100% (186/186), done.
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

D:\Apps\Git 2.20.1>

So guys, any help will be much appreciated.
Thanks in advance.

Ok, after I’ve added these settings to my global git config file I can say it works sporadically:

[user]
	email = kristian.kirilov@gmail.com
	name = Kristian Kirilov
[core]
	longpaths = true
	compression = 0
	packedGitLimit = 1024m 
	packedGitWindowSize = 2048m 
[pack] 
	deltaCacheSize = 2047m 
	windowMemory = 4096m

But I’m still wondering what are the correct values to add in order go get this working all the time.

PS E:\Temporary> git clone git@gitlab.home.lan:administration/puppet.git
Cloning into 'puppet'...
remote: Enumerating objects: 2555, done.
remote: Counting objects: 100% (351/351), done.
remote: Compressing objects: 100% (267/267), done.
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
PS E:\Temporary> git clone git@gitlab.home.lan:administration/puppet.git
Cloning into 'puppet'...
remote: Enumerating objects: 2555, done.
remote: Counting objects: 100% (351/351), done.
remote: Compressing objects: 100% (267/267), done.
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
PS E:\Temporary> git clone git@gitlab.home.lan:administration/puppet.git
Cloning into 'puppet'...
remote: Enumerating objects: 2555, done.
remote: Counting objects: 100% (351/351), done.
remote: Compressing objects: 100% (267/267), done.R
remote: Total 2555 (delta 58), reused 234 (delta 34), pack-reused 2204R
Receiving objects: 100% (2555/2555), 1.88 MiB | 18.17 MiB/s, done.
Resolving deltas: 100% (391/391), done.
PS E:\Temporary>

Your Linux version of git is 2.25.1 and the Windows one is 2.20.1 so not the same version. Maybe download the latest Git for Windows which is 2.33.0 which might rule out any issues and try that just in case there are some problems with Git 2.20.1 under Windows.

The other things to check, what are the differences between these two machines? Are they physical or virtual servers? What network card?

I use Git under Windows and pull from my Gitlab repo without any problems and I’m using 2.30.0.windows.2

No no, please double check. The first test is made with the latest version of Git for Windows.
The second is made with version 2.25 but running on Linux. And the third one is made with portable version of Git for Windows which is version 2.20.

Windows box is the same every time - my physical desktop box.
Gitlab and Puppet server are virtual machines under Linux.

Ah yes, I see now, sorry about that.

A quick google gave me these parameters to try to debug it:

the post I linked might help get some more info from it. If you are sure your network connection is stable, network card, cables, switch/hub that you are connected to, then would just need to get more info. Some people experienced this with github also, so it’s not Gitlab-related, but a git issue itself.

If you are using some anti-virus program other than Windows Defender, you might want to disable that temporarily as well and try your git commands.

Yeah, most probably not gitlab at all, but because I’ve checked with github and there is no problem, this pointed me to thing in this direction.
Regarding the tests mentioned in the link you sent:

PS E:\Temporary> set GIT_TRACE_PACKET=1
PS E:\Temporary> set GIT_TRACE=1
PS E:\Temporary> set GIT_CURL_VERBOSE=1
PS E:\Temporary> git config --global core.compression 0
PS E:\Temporary> git clone --depth 1 git@gitlab.home.lan:administration/puppet.git
Cloning into 'puppet'...
remote: Enumerating objects: 2303, done.
remote: Counting objects: 100% (2303/2303), done.
remote: Compressing objects: 100% (1689/1689), done.R
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOFs:  99% (2280/2303)
fatal: fetch-pack: invalid index-pack output
PS E:\Temporary> git clone --depth 1 git@gitlab.home.lan:administration/puppet.git
Cloning into 'puppet'...
remote: Enumerating objects: 2303, done.
remote: Counting objects: 100% (2303/2303), done.
remote: Compressing objects: 100% (1689/1689), done.
Rremote: Total 2303 (delta 321), reused 2281 (delta 316), pack-reused 0
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOFs:  99% (2280/2303)
fatal: fetch-pack: invalid index-pack output
PS E:\Temporary> git clone --depth 1 git@gitlab.home.lan:administration/puppet.git
Cloning into 'puppet'...
remote: Enumerating objects: 2303, done.
remote: Counting objects: 100% (2303/2303), done.
remote: Compressing objects: 100% (1689/1689), done.R
remote: Total 2303 (delta 321), reused 2281 (delta 316), pack-reused 0
Receiving objects: 100% (2303/2303), 1.79 MiB | 18.91 MiB/s, done.
Resolving deltas: 100% (321/321), done.
PS E:\Temporary> cd .\puppet\
PS E:\Temporary\puppet> git fetch --unshallow
remote: Enumerating objects: 319, done.
remote: Counting objects: 100% (319/319), done.
remote: Compressing objects: 100% (118/118), done.
Rfetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOFs:  20% (51/252)
fatal: fetch-pack: invalid index-pack output
PS E:\Temporary\puppet> git fetch --unshallow
remote: Enumerating objects: 319, done.
remote: Counting objects: 100% (319/319), done.
remote: Compressing objects: 100% (118/118), done.
Receiving objects:  78% (197/252)emote: Total 252 (delta 118), reused 231 (delta 102), pack-reused 0)
Receiving objects: 100% (252/252), 57.27 KiB | 5.21 MiB/s, done.
Resolving deltas: 100% (118/118), completed with 49 local objects.
PS E:\Temporary\puppet> git pull --all
Fetching origin
Already up to date.
PS E:\Temporary\puppet>

So as you see, it succeeded but with many tries.

Some more: linux - Git, WSL2, SSH: unexpected disconnect while reading sideband packet - Server Fault

in particular:

The trick was git config --global core.compression 0

maybe also try cloning/pushing over http/https instead of ssh also.

And this link also seems to hint at that global core.compression also for Windows: [Solved] unexpected disconnect while reading sideband packet fatal: the remote end hung up unexpectedly

As you see in the post above, I tested all of this already.
Unfortunately without success. The network shouldn’t be a problem, because I’m testing on local area network.
Cloning via HTTP/HTTPS is not a solution, because I have to put my credentials every time, but I’m looking for an automated approach.

Temporarily you can attempt http/https and see if it’s successful. Also in .git/config, you can put the url format as:

https://username:token@gitlab.myhost.com/groupname/projectname

replacing username and token with a token created under your user profile. Stops you having to enter one each time.

Reason I suggest doing it over http/https it to check if the problem occurs or not. If yes, then we know there is a problem with doing it over ssh. If it happens on both, then it means more likely a problem with your computer, your network connection, as all those posts and people who posted solutions also had that same error because of network problems at their end.

A yeah, sounds reasonable.

No worries using HTTP/HTTPS cloning, I have 3 of 3 successful attempts.

PS E:\Temporary> git config --global http.sslVerify false
PS E:\Temporary> git clone https://gitlab.home.lan/administration/puppet.git
Cloning into 'puppet'...
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
remote: Enumerating objects: 2555, done.
remote: Total 2555 (delta 0), reused 0 (delta 0), pack-reused 2555 eceiving objects:  92% (2351/2555)
Receiving objects: 100% (2555/2555), 1.83 MiB | 19.37 MiB/s, done.
Resolving deltas: 100% (448/448), done.
PS E:\Temporary> git clone https://gitlab.home.lan/administration/puppet.git
Cloning into 'puppet'...
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
remote: Enumerating objects: 2555, done.
remote: Total 2555 (delta 0), reused 0 (delta 0), pack-reused 2555 eceiving objects:  96% (2453/2555)
Receiving objects: 100% (2555/2555), 1.83 MiB | 19.57 MiB/s, done.
Resolving deltas: 100% (448/448), done.
PS E:\Temporary> git clone https://gitlab.home.lan/administration/puppet.git
Cloning into 'puppet'...
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
remote: Enumerating objects: 2555, done.
remote: Total 2555 (delta 0), reused 0 (delta 0), pack-reused 2555R
Receiving objects: 100% (2555/2555), 1.83 MiB | 19.17 MiB/s, done.
Resolving deltas: 100% (448/448), done.
PS E:\Temporary>

So, what I’ve done (not sure how this help but at least):

I installed latest version of OpenSSH and Git for Windows on Windows Server 2016 (placed in the same network segment as the gitlab.home.lan server) and everything worked like charm.
I was able to use git clone via SSH, I had 3 successful attempts in a row.

In the second test, I’ve created a new Windows 10 VM with the same version/updates/patches as the version of my Workstation, then used the SSH native client and latest version of git and here the issue appeared again. The only one difference between the Workstation I use and that VM is that the Workstation is physical box, but the VM is virtual one.

So in a nutshell I can say this is issue on SSH client (which comes natively with Windows 10) or an issue related to the Operating System version for instance…

1 Like

This made me to give up…

I’ve removed the native SSH client from Windows and installed the latest from Github.
Then I modified everything about path/variables and so on - the issue still exist.

So I simply consider that the issue is on OS.
Not need to blame SSH or GIT anymore.