Often Bitbucket is unable to successfully clone repositories using the HTTPS protocol. A typical error response is:
Cloning Repo: firstname.lastname@example.org:team/repo.git error: RPC failed; curl 52 Empty reply from server
We tried setting this config variable as a workaround, but it does not work:
git config --global http.postBuffer 524288000
We implemented retries, but this does not work either.
A reliable workaround exists, which is to use SSH cloning instead, however this is not always possible.
It appears as though once the repository get into a certain state the error occurs deterministically. This appears to be at least somewhat related to the repository size - repositories over 800 MB are more likely to be affected.
In the past, we've been told that affected repositories needed
git gc to be run on the server or that "repository/Git/network configurations need to be tweaked", however this is not something that we can do as a Bitbucket user.