The git clone command assumes everyone has unlimited fixed-rate Internet. I have no Internet. Sometimes I’m on a friend’s measured rate uplink with a tight quota. So I cannot be blindly fetching a repository that blows copious amounts of quota.

Fuck surprises. They suck. How do I inform myself of the consequences of git clone before running it?

HTTP has a useful facility: the content-length: header. So this gives a way to get the size of a single web object before fetching:

curl -L --head "$url" | grep -i content-length

If git count-objects were sophisticated enough, it could perhaps theoretically get a tree of objects without their contents and perform the above header check on each object.

The only viable option is apparently to run git clone in a remote shell account just for the purpose of running git count-objects, then delete the clone and rerun the clone op locally if the size is acceptible.

Any better ideas?