Skip to content

Instantly share code, notes, and snippets.

@dingzeyuli
Created December 16, 2016 22:34
Show Gist options
  • Select an option

  • Save dingzeyuli/f07c126b74371adba4b7dbe181cb57d2 to your computer and use it in GitHub Desktop.

Select an option

Save dingzeyuli/f07c126b74371adba4b7dbe181cb57d2 to your computer and use it in GitHub Desktop.
Check the size of a github repo before downloading
# http://webapps.stackexchange.com/questions/39587/view-estimated-size-of-github-repository-before-cloning
# tested on macOS
echo https://github.com/torvalds/linux.git | perl -ne 'print $1 if m!([^/]+/[^/]+?)(?:\.git)?$!' | xargs -I{} curl -s -k https://api.github.com/repos/'{}' | grep size
# output:
# "size": 1746294,
@prajwal89

prajwal89 commented Oct 19, 2023

Copy link
Copy Markdown

I've developed a tool for checking GitHub repository sizes by leveraging the GitHub API.
You can find the tool here:
GitHub Repository Size Checker

@pa-0

pa-0 commented May 22, 2024

Copy link
Copy Markdown

Based on what I've read, GitHub support has indicated that due to Git Alternates and the way files are stored in GitHub repositories, the numbers returned from the GitHub API cannot be relied upon for the actual size.

@ren-chon

Copy link
Copy Markdown

I've developed a tool for checking GitHub repository sizes by leveraging the GitHub API. You can find the tool here: GitHub Repository Size Checker

Great tool!
Could you add checking based on the last commit?

@AmanuelCh

Copy link
Copy Markdown

I've developed a tool for checking GitHub repository sizes by leveraging the GitHub API. You can find the tool here: GitHub Repository Size Checker

I've been using this tool for quite some time, but it throws an error lately. So, I developed another web-based tool.
Site link: Repo Size Checker

@gouthamb002

Copy link
Copy Markdown

I've developed a tool for checking GitHub repository sizes by leveraging the GitHub API. You can find the tool here: GitHub Repository Size Checker

I've been using this tool for quite some time, but it throws an error lately. So, I developed another web-based tool. Site link: Repo Size Checker

Thanks a lot for this!

@olivvius

olivvius commented Mar 21, 2025

Copy link
Copy Markdown

no way to get the size of a branch only?
github API returns only full repo size so i guess for now, no way to grep only branch size?
Edit : you can know check the size of one or several branches of a repo without downloading it:
https://github.com/olivvius/git_branch_size

@rahil627

Copy link
Copy Markdown

urgh.. thank goodness for codeberg.. what a mess!

@rahil627

Copy link
Copy Markdown

ah ha! i found it while migrating my repos, while searching for a recently deleted repo..

https://github.com/settings/repositories

@jubilancy

Copy link
Copy Markdown

I've developed a tool for checking GitHub repository sizes by leveraging the GitHub API. You can find the tool here: GitHub Repository Size Checker

thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment