Search code examples
github

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


In Github, is there a way I can see the number of downloads for a repo?


Solution

  • Update 2019:

    Ustin's answer points to:


    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:

    Git 2.14.2 release


    Update August 2014

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

    https://i.sstatic.net/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.