this post was submitted on 02 Aug 2026
1 points (100.0% liked)

🖧🗫🤝 Collaboration tools 🛠⚒🚧 (git, forges, bug trackers 🔎🪲, gitea, gitlab)

132 readers
1 users here now

This is going to generally be about git forges like gitea, but it’s open to discussion about any collaboration assisting tools and platforms.

Related communities: !librecomms@scribe.disroot.org

founded 5 years ago
MODERATORS
 

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?

top 2 comments
sorted by: hot top controversial new old
[–] SnoopSqueak@lemmy.today 3 points 1 month ago (1 children)

Instead of git clone, initialize a new local repository, add the remote origin, and then git fetch:

https://stackoverflow.com/questions/2882620/is-it-possible-to-remote-count-object-and-size-of-git-repository

[–] freedomPusher@sopuli.xyz 2 points 1 month ago* (last edited 1 month ago)

Thanks! That link is jailed in Cloudflare’s walled garden but this variant is reachable to everyone (in case someone else wants to follow this):

https://overflow.ocus.top/questions/2882620/is-it-possible-to-remote-count-object-and-size-of-git-repository

The fetch operation does not disclose the total before fetching, but it gives a way to monitor progress which is good enough in some situations. I wonder if the percentage can be trusted. If the percentage is accurate, then it must also know the total. But the ratio is not apparently based on size.

Further down in your same article, there is a Github-specific way to get the size, which I tweaked to:

$ curl -sL https://api.github.com/repos/Marijnh/CodeMirror | jq -r .size

Perhaps the best generic answer (independent of Github) is further down the same page. This comment gives a codified way of doing what I was contemplating.

I appreciate the helpful link. Though I’m seeing a huge discrepency. E.g., for this repo, curl gives 34785 (which is apparently in kilobytes) and git count-objects -vH after fetching gives about the same answer. Yet the repo is actually nearly double that size (~61 mb).