15

I only need one particular file from a project published on GitHub so it makes little sense to download the whole project. But I just can't find the download button.

19

If you're viewing the contents of the file itself there should be a "Raw" button.

get raw

You can either:

  • Right-click on that and select the "Save content as..." (or similar depending on your browser)
  • Click through to see the contents dumped onto the screen and save from there
  • 9
    That's a high-qwality arrow there. – Fake Name Dec 23 '15 at 23:25
  • 4
    I thought it was Dumbledore. – RockPaperLizard Dec 24 '15 at 0:30
  • 7
    Append ?raw=true to the URL of file. – Ivan Chau Dec 24 '15 at 6:06
8

In the list of files, every filename is a link. A simple right-click and "Save link as..." (or equivalent for your browser) will allow you to download a single file.

This breaks down with HTML files, however. You'll need to use the "Raw" button on the file page as Eight Days of Malaise's answer describes. I'm using Google Chrome. You may have a different experience on a different browser.

  • 1
    Those links go the the html page for that file, not the file itself. (Unless you're referring to another file list, in which case you should extend your answer to describe how to get to that file list) – CodesInChaos Dec 23 '15 at 17:03
  • 1
    @CodesInChaos: It works just fine. Yes, if you just click the link it will open GitHub's page for that file, but "Save link as..." saves the file in its "native format". – ale Dec 23 '15 at 19:13
  • This doesn't seem to work with HTML files. – Zenadix Dec 23 '15 at 19:24
  • 1
    For me it never works (Using Firefox). It always downloads github's html page for that file. – CodesInChaos Dec 23 '15 at 20:53
  • 1
    Tested it in chrome and it doesn't work either. The downloaded file still contains html. Did you check the content of the file? – CodesInChaos Dec 23 '15 at 21:14
1

Check out RawGit which is a free service to serve files directly from Github with proper Content-type headers.

Example URL: https://rawgit.com/user/repo/branch/file

  • It is caching. Sometimes permanently. – Nakilon Dec 6 '17 at 21:48
0

You can try github-files-fetcher, it is a command line tool which downloads a single folder or file from a GitHub repo.

Think a real scenario: you were visiting the following webpage page and wanna download the async subdirectory alone.

redux

With The github-files-fetcher, you should first copy the url of that page, which is https://github.com/reduxjs/redux/tree/master/examples/async, and then run the command below in command line:

fetcher --url=https://github.com/reduxjs/redux/tree/master/examples/async

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.