Is there an easy way to get the size of a public or private github repository?
I tried this method which seems to work well for public repositories (returning "size": 2994520
):
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
but doesn't seem to work for private repositories (it returns the message 'Not Found')
Is there some way (via an API, the browser, or bash script) that can retrieve the size of a github repository (as distinct from a local git repository)?
Note: important that the solution works for private repositories the user has access to (not just public ones)