24

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,400
  • 4
  • 16
  • 31

2 Answers2

32

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
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
27

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
  • 20,752
  • 7
  • 62
  • 64
  • 1
    Thank you. This is an absolutely brilliant tool. And thank you for not charging £60/month, for such a service, which seems to be the norm, nowadays. Much appreciated – Charles Robertson Dec 01 '22 at 00:16