Btw. with rhodecode, we had other similar occasional errors with sometimes random-looking error-codes like: 0, None, 403. None of them makes acutally sense as when trying 5 minutes later, it works gracefully.
I will see if I can get my hands on some logfiles. I remember us looking through them when using rhodecode, but the error was not comprehensible.
We indedd serve git repositories only. It happens occasionally and there is no apparent pattern. After talking to my team members, they also incurred it when doing "git clone https://" instead of "pip install -e git+https://....".
I could reproduce something that looked like the failure rhodecode issue you linked to when trying to clone with git --depth ... and the patch above seemed to fix it ... and it is unrelated to the fix for #32.
I do however not know anything about git (or care that much about it) so I would appreciate if someone with git knowledge could review and/or give it some serious testing.
It is possible that your initial problem was a duplicate of #32 but you gave a hint towards another and real problem.