20

I want to download this source file in the zip here:

https://github.com/xdtianyu/android-4.2_r1/tree/master/packages/apps/SoundRecorder

But there is no Zip Download button. There is a Zip Download button in the root directory of the repository:

https://github.com/xdtianyu/android-4.2_r1

But I don't want to download the whole repository. How can I download that single project (specific subdirectory)?

I read this topic but still, I can't Download source as the zip file:

Download single files from GitHub

How to download source in ZIP format from GitHub?

Mehrdad Salimi
  • 1,198
  • 3
  • 15
  • 29

2 Answers2

25

You can't download a subdirectory from GitHub as a zip file.

Some options are to

  • download the full zip and manually extract the subdirectory that you want, or
  • use git with sparse checkouts instead of downloading as a zip file.
    • This approach does download the entire repository into the .git directory, but your working copy will only contain the files and directories that you want.

For more information on sparse checkouts have a look at this answer.

Community
  • 1
  • 1
Chris
  • 112,704
  • 77
  • 249
  • 231
25

Use DownGit; you can download individual files or directories, and even create download-link for them-

image

You can also configure properties of the download-file. See here for detailed usage.


Disclaimer: I fell into the same problem as the question-asker, could not find any proper solution, so I created this tool for my own use, and later made it available for everyone.

Minhas Kamal
  • 17,370
  • 5
  • 57
  • 58