Take the 2-minute tour ×

I guess most of you, developers, use any VCS, and I hope some of you use Git. Do you have any tip or trick how to get a download URL for a single file in a repository?

I don't want the URL for displaying the raw file; in case of binaries it's for nothing.


Is it even possible to use GitHub as a "download server"?

If we decide to switch to Google Code, is the mentioned functionality presented here?

Or is there any free-of-charge hosting and VCS for open-source projects?

I appreciate any idea.

share|improve this question
It asks several unrelated questions, it's not particularly clear, and it states a non-fact (most people use CVS) that might have annoyed someone. –  bmargulies Jan 5 '11 at 13:55
OK, i will never do that in the future, thanks for explanation. –  Radek Simko Jan 5 '11 at 14:07
Also, did you mean VCS instead of CVS ? –  ismail Jan 5 '11 at 14:31
that support link is now 404d –  jcollum Mar 20 '14 at 18:02
@pnuts is for me, it just goes to a contact us page –  jcollum Jul 9 '14 at 23:33

12 Answers 12

up vote 121 down vote accepted

Git does not support downloading parts of the repository. You have to download all of it. But you should be able to do this with GitHub.

When you view a file it has a link to the "raw" version. The URL is constructed like so


By filling in the blanks in the URL, you can use Wget or cURL or whatever to download a single file. Again, you won't get any of the nice version control features used by Git by doing this.

Update: I noticed you mention this doesn't work for binary files. You probably shouldn't use binary files in your Git repository, but GitHub has a download section for each repository that you can use to upload files. If you need more than one binary, you can use a .zip file. The URL to download an uploaded file is:

share|improve this answer
You can actually download only parts of a repository (in terms of history) using --depth. However, it will break further synchronization with the initial repository (since it effectively re-builds a different history). –  Bruno Nov 16 '11 at 11:20
Note for posterity: I just tested it and using raw works fine for binary files. –  emmby Dec 23 '12 at 17:11
tried for a ~10 MB zip file got error: Error: blob is too big –  ina Feb 16 '13 at 10:37
The suggested URL format doesn't work for me. I find that https://raw.github.com/user/repository/branch/filename works. –  Brian C. Mar 27 '13 at 15:57
@BrianC.: (At least as of 27 August 2013) the URL format mentioned in the answer (raw after the repository name) is now automatically redirected to the format you mention (hostname raw.github.com). When in doubt, browse to the file in question on github.com and click on the 'Raw' button. –  mklement0 Aug 27 '13 at 20:50
  1. Go to the file you want to download.
  2. Click it to view the contents within the GitHub UI.
  3. In the top right, right click the Raw button.
  4. Save as...
share|improve this answer
This doesn't work with large files. –  Matt Parkins Jan 2 '13 at 14:53
But good for most situations. –  Ryan H. Feb 6 '13 at 20:14
Instead of "Save as", copy the URL. Thats the URL of the file. You can now download it with any tool that use the URL to download: wget, your browser, etc. –  jgomo3 Apr 8 '13 at 15:03
@MattParkins I just tried it and I think it DOES work now for large files (even binary file with the "we can't show files that are this big right now" warning) –  lmsurprenant Oct 23 '13 at 13:38
Stop doing this verbose steps, use this chrome extension to do. chrome.google.com/webstore/detail/github-mate/… –  Cam Song Dec 17 '13 at 14:37

You can use the V3 API to get a raw file like this (you'll need an OAuth token):

curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path

All of this has to go on one line. The -O option saves the file in the current directory. You can use -o filename to specify a different filename.

To get the OAuth token follow the instructions here: https://help.github.com/articles/creating-an-access-token-for-command-line-use

I've written this up as a gist as well: https://gist.github.com/madrobby/9476733

share|improve this answer
This one is good, but unfortunately it only supports files up to 1 MiB in size. –  Per Lundberg Aug 6 '14 at 8:23
If executing this within a program, be sure User-Agent is set. –  Zugwalt Oct 29 '14 at 21:28

GitHub Mate makes single file download effortless, just click the icon to download, currently it only work on Chrome.

GitHub Mate Download

share|improve this answer
This is my favorite answer here –  jcollum Mar 20 '14 at 18:06
This doesn't work. –  Jahkobi Digital Apr 12 '14 at 0:02
@jcollum Checked just now, works for me. Can you make sure you are using the latest version? or let me know the error. Glad to help you to make it work. –  Cam Song Apr 12 '14 at 7:14
@CamSong huh? .... –  jcollum Apr 13 '14 at 2:49
I am on the newest version of Chrome, 34.0.1847.116, and this surely does not work. What operating system are you using? Im on OS X Mavericks. –  Jahkobi Digital Apr 14 '14 at 23:05

This is now possible in GitHub for any file. You need to translate your files for raw.github.com. For example, if your file is in your repository at:


Using wget you can grab the raw file from:


Rails Composer is a great example of this.

share|improve this answer
Some files are hosted on raw.githubusercontent.com –  jcollum Mar 20 '14 at 18:07
and some times it's raw2.github.com just fyi –  jeremy.bass Apr 11 '14 at 20:07
  1. The page you linked to answers the first question.

  2. GitHub also has a download facility for things like releases.

  3. Google Code does not have Git at all.

  4. GitHub, Google Code and SourceForge, just to start, are free hosting. SourceForge might still do CVS.

share|improve this answer

I think the new url structure is raw.giturl for example:

git file


share|improve this answer
Sometimes the raw url is like this instead (raw.githubusercontent.com): raw.githubusercontent.com/warpech/jquery-handsontable/master/… –  jcollum Mar 20 '14 at 18:05

To follow up with what thomasfuchs said but instead for GitHub Enterprise users here's what you can use.

curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://your_domain/api/v3/repos/owner/repo/contents/path

Also here's the API documentation https://developer.github.com/v3/repos/contents

share|improve this answer

This is what worked for me just now...

1) Open the raw file in a seperate tab.

2) Copy the whole thing in your notepad in a new file.

3) Save the file in the extension it originally had

...worked for the .php file I DL just now.

share|improve this answer

1)On the right hand side just below "Clone in Desktop" it say's "Download Zip file"
2)Download Zip File
3)Extract the file

share|improve this answer

If you happen to use curl and firefox... you could use the cliget add-on which generates a curl call including all authentication mechanisms (aka cookies).

So right click on the raw button cliget->"copy url for link" and then paste that into a shell. You will get your file even if you had to log-in to see it.

share|improve this answer

This would definitely work. At least in Chrome. Right click -> Save Link As.

share|improve this answer
Have you tried this before downmarking? The user need to download one single file from GIT repository. User can go the the particular file and do as mentioned above. Let me know if you need help doing that. –  Ankish Jain Mar 4 at 11:39

Your Answer


