Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There is no "zip download" button to download source in .zip on github

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?

like image 439
Mehrdad Salimi Avatar asked Mar 01 '14 12:03

Mehrdad Salimi


People also ask

Why is there no download button on GitHub?

When you view individual files on GitHub, you'll notice the button to download the code isn't there. You'll instead see the download button on the right side of the page when you navigate to the root of the repository.

How do I download a ZIP file from GitHub?

When downloading materials to your laptop, it is easiest to download the entire repository. To do this, go to the GitHub page for the workshop, click on the green Code button, then download the repository as a ZIP file. The filename may be different than what's in the picture. Find the downloaded .

How do I enable Downloads on GitHub?

To download from GitHub, you should navigate to the top level of the project (SDN in this case) and then a green "Code" download button will be visible on the right. Choose the Download ZIP option from the Code pull-down menu. That ZIP file will contain the entire repository content, including the area you wanted.


1 Answers

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.

like image 84
Chris Avatar answered Sep 22 '22 18:09

Chris