GitHub – View Estimated Repository Size Before Cloning

github

I want to view the total repo size of a project hosted on GitHub without having to clone it. Sometimes I do this:

  1. Start cloning some GitHub repository

    Receiving objects: 45% (218/476), 5.50 MiB | 27 KiB/s

    Already drained 5MB? Suspend…

    ^Z
    
  2. Clone the repository on a server with a normal internet connection just to see its size.

  3. Continue (or abort) the local cloning.

How do I find out the repository size in advance? In the search I see repository size, but not in other places.

Best Answer

Using Github API:

$ echo https://github.com/hlamer/enki.git | perl -ne 'print $1 if m!([^/]+/[^/]+?)(?:\.git)?$!' | xargs -i curl -s -k https://api.github.com/repos/'{}' | grep size
"size": 284,