Download Directory from GitHub - github

Trying to download a folder from git.
I tried wget --no-parent -r http://WEBSITE.com/DIRECTORY and also without --no-parent - did not work. curl works fine with single files, I thought wget should get the folder - it does everything but that.
Tried many options as suggested Using wget to recursively fetch a directory with arbitrary files in it none worked

You should try:
git clone <SSH> or <HTTPS>
Maybe this can help you in a simple way:
DownGit
So, if you instead to use wget to download a directory, just try this.
It will pack your target directory into a .zip, so you can curlorwget it.
MinhasKamal/DownGit#github
In default, value of fileName and rootDirectory is set to the name of the downloading file or directory. If you do not want to add the directory itself in the zip, then set rootDirectory=false. Like: this link- https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/MinhasKamal/DownGit/tree/master/res/images&rootDirectory=false, will download a file named images.zip; however the root directory- "images", will not be included in the zip.
If you want to download file- https://github.com/MinhasKamal/DownGit/blob/master/res/images/downgit.png with name- DownGitIcon.zip, then the link will be- https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/MinhasKamal/DownGit/blob/master/res/images/downgit.png&fileName=DownGitIcon
By the way, I used to use SVN to download files/directory from a Git System by route the URL to its trunk. But it's very inconvenient.

A bit late but in case some one stumbles here later.
You can use following tools :
Download-Directory
DownGit
In both tools, you can just enter your url to direct download or create a download link.

For those who prefer GUI tools, there is another easy way to download a folder using code sandbox.
Navigate to the folder and replace github to githubbox in the URL. Then on code sandbox go to files pain on the left and hover the mouse over the down arrow, it will show a popup tooltip "Export to Zip". Just click on it to download the folder as a zip file.
reference: Download a single folder or directory from a BRANCH in GitHub repo

Related

Move files into a folder in GitHub (At their website)

I would like to move files and (if possible) folders into another folder, at a Git repository (trough the GitHub website - so not using the terminal).
Is this possible? if so, how?
A solution is described in the GitHub docs here.
You browse to the file you want to move, click on Edit this file and change the path to your desired path.
You might have to experiment around but the following might be helpful:
This will show you how to move/rename files. You can change the folder path: https://github.blog/2013-03-15-moving-and-renaming-files-on-github/
This here will show you how to create a folder: https://github.community/t/add-a-folder/2304
Renaming a folder will be difficult. How many files are in this folder? You essentially move a file. It's a bloody pain.
I'll adjust this with additional tips.

specify what files from the repository are included in master.zip when using the "Download ZIP" link on GitHub

Is it possible to specify what files are included or not included in the zip file when you use the "Download ZIP" link in a repository? Or do I need to make my own?
You need to make your own: even the GitHub API only exposes the archive link, without any customization.
You would get a tarball or zipball archive for a full repository, not for a subset.
You can click on specific file and then "Raw" and download them separately and ZIP them after that.
This is useful for a few files project / small files though.

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?
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.
Use DownGit; you can download individual files or directories, and even create download-link for them-
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.

Is there a way to control what gets into a GitHubs zipball?

Every GitHub repo has the Download ZIP button, but is there a way to control what gets into the final zipball. For example we do not need and hidden files there, or even - unit tests.
Excerpt from Pro Git book:
You can tell Git not to export certain files or directories when
generating an archive. If there is a subdirectory or file that you
don’t want to include in your archive file but that you do want
checked into your project, you can determine those files via the
export-ignore attribute.
For example, say you have some test files in a test/ subdirectory, and
it doesn’t make sense to include them in the tarball export of your
project. You can add the following line to your Git attributes file:
test/ export-ignore
Now, when you run git archive to create a tarball of your project,
that directory won’t be included in the archive.

create a distribution file for downloading with wget at github - no git needed

I'd like users to be able to issue something like:
wget https://nodeload.github.com/opensas/play-demo/zipball/master/opensas-play-demo-bb3a405.zip
without having to clone the whole repo, nor browsing to github to manually download it
apparently, github issues some kind of redirect when accessing:
https://nodeload.github.com/opensas/play-demo/zipball/master
and it just downloads some binary file instead...
is there some easy way to achieve it???
I've just found the asnwer
I made a distribution zip file
Uploaded it with "add new download" option
and now I have the following url to get it:
https://github.com/downloads/opensas/play-demo/play-demo-at-jugar-2011_09_29.zip