I have been using Git on Windows for quite a long time without any problems, but recently on Windows 11 23H2 and above, every time I clone a fairly large repository with many files it tends to get stuck / freeze / hang, as shown below.
remote: Counting objects: 6666, done.
remote: Compressing objects: 100% (5941/5941), done.
Receiving objects: 23% (1534/6460), 11.68 MiB | 23 KiB/s
I reinstalled Git several times myself and tried a number of configurations, but nothing worked — even asking ChatGPT, Gemini and other LLMs gave no proper solution. Until finally I searched manually on Google and found the solution, which is to run the command below.
git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"
That command swaps the ssh executable to the one bundled with Windows, which means the ssh that ships with Git is the broken one — and that is confirmed in the issue below.
https://github.com/git-for-windows/git/issues/5199
However, even though it has been merged, the issue is still open to this day.
Reference
https://stackoverflow.com/questions/11941175/git-fetch-pull-clone-hangs-on-receiving-objects