Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github: Can I see the number of downloads for a repo?

Tags:

github

Update 2019:

Ustin's answer points to:

  • API /repos/:owner/:repo/traffic/clones, to get the total number of clones and breakdown per day or week, but: only for the last 14 days.
  • API /repos/:owner/:repo/releases/:release_id for getting downloads number of your assets (files attached to the release), field download_count mentioned below, but, as commented, only for the most recent 30 releases..

Update 2017

You still can use the GitHub API to get the download count for your releases (which is not exactly what was asked)
See "Get a single release", the download_count field.

There is no longer a traffic screen mentioning the number of repo clones.
Instead, you have to rely on third-party services like:

  • GitItBack (at www.netguru.co/gititback), but even that does not include the number of clones.

  • githubstats0, mentioned below by Aveek Saha.

  • www.somsubhra.com/github-release-stats (web archive), mentioned below.
    For instance, here is the number for the latest git for Windows release

Git 2.14.2 release


Update August 2014

GitHub also proposes the number of clones for repo in its Traffic Graph:
See "Clone Graphs"

http://i.stack.imgur.com/uycEZ.png


Update October 2013

As mentioned below by andyberry88, and as I detailed last July, GitHub now proposes releases (see its API), which has a download_count field.

Michele Milidoni, in his (upvoted) answer, does use that field in his python script.
(very small extract)

c.setopt(c.URL, 'https://api.github.com/repos/' + full_name + '/releases')
for p in myobj:
    if "assets" in p:
        for asset in p['assets']:
            print (asset['name'] + ": " + str(asset['download_count']) +
                   " downloads")

Original answer (December 2010)

I am not sure you can see that information (if it is recorded at all), because I don't see it in the GitHub Repository API:

$ curl http://github.com/api/v2/yaml/repos/show/schacon/grit
---
repository:
  :name: grit
  :owner: schacon
  :source: mojombo/grit # The original repo at top of the pyramid
  :parent: defunkt/grit # This repo's direct parent
  :description: Grit is a Ruby library for extracting information from a
  git repository in an object oriented manner - this fork tries to
  intergrate as much pure-ruby functionality as possible
  :forks: 4
  :watchers: 67
  :private: false
  :url: http://github.com/schacon/grit
  :fork: true
  :homepage: http://grit.rubyforge.org/
  :has_wiki: true
  :has_issues: false
  :has_downloads: true

You can only see if it has downloads or not.


Adam Jagosz reports in the comments:

I got it to work with

 curl -H "Accept: application/vnd.github.v3+json"   https://api.github.com/repos/:user/:repo/releases

A couple of things that I had wrong:

  • I needed an actual Github release (not just git tag, even though Github does display those under releases, ugh).
  • And the release needs an asset file other than the zipped source that is added automatically in order to get the download count.

I have written a small web application in javascript for showing count of the number of downloads of all the assets in the available releases of any project on Github. You can try out the application over here: http://somsubhra.github.io/github-release-stats/


VISITOR count should be available under your dashboard > Traffic (or stats or insights):

enter image description here


GitHub has deprecated the download support and now supports 'Releases' - https://github.com/blog/1547-release-your-software. To create a release either use the GitHub UI or create an annotated tag (http:// git-scm.com/book/ch2-6.html) and add release notes to it in GitHub. You can then upload binaries, or 'assets', to each release.

Once you have some releases, the GitHub API supports getting information about them, and their assets.

curl -i \
https://api.github.com/repos/:owner/:repo/releases \
-H "Accept: application/vnd.github.manifold-preview+json"

Look for the 'download_count' entry. Theres more info at http://developer.github.com/v3/repos/releases/. This part of the API is still in the preview period ATM so it may change.

Update Nov 2013:

GitHub's releases API is now out of the preview period so the 'Accept' header is no longer needed - http://developer.github.com/changes/2013-11-04-releases-api-is-official/

It won't do any harm to continue to add the 'Accept' header though.


Formerly, there was two methods of download code in Github: clone or download as zip a .git repo, or upload a file (for example, a binary) for later download.

When download a repo (clone or download as zip), Github doesn't count the number of downloads for technical limitations. Clone a repository is a read-only operation. There is no authentication required. This operation can be done via many protocols, including HTTPS, the same protocol that the web page uses to show the repo in the browser. It's very difficult to count it.

See: http://git-scm.com/book/en/Git-on-the-Server-The-Protocols

Recently, Github deprecate the download functionality. This was because they understand that Github is focused in building software, and not in distribute binaries.

See: https://github.com/blog/1302-goodbye-uploads


As mentioned, GitHub API returns downloads count of binary file releases. I developed a little script to easly get downloads count by command line.