Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate download link for a single folder in GitHub

I have a repository that has several folders of code. I'd like to be able to provide a link to the code in a single folder so another user could download just the relevant bits of code without being bloated by the rest of the codebase and without requiring that they have git installed on their machine.

Of course, they can browse the code files inside of the folder online, but that isn't very helpful if they want to run a single project.

Here are several other similar questions, and why I don't think they address my particular issues:

  • How to download source in .zip format from GitHub?
    • Only provides a way to download the entire project, otherwise perfect.
  • Github download folder as zip
    • This answer is for build artifacts. I don't want to upload the source code twice just so I can provide a download link to it.
  • Download a single folder or directory from a GitHub repo
    • Requires using git commands to get a single folder. I'd rather have the link accessible to multiple people without requiring they have git installed.
  • GitHub - Download single files
    • Only provides mechanism for downloading single files, not folders

In case it helps provide a concrete example, here's a folder that I would like to be able to download via a link:
https://github.com/KyleMit/CodingEverything/tree/master/MVCBootstrapNavbar/Source%20Code

Is there any way to do this?

like image 325
KyleMit Avatar asked May 02 '14 20:05

KyleMit


People also ask

Can you download single from GitHub?

GitHub lets you download one file from a repository. This is a useful feature because it means you do not have to clone or retrieve an entire repository to download a particular file.

How do I download individual files from repository?

just enter the command in the terminal: #wget https://raw.githubusercontent.com/... A while the file will put in your folder.


2 Answers

Go to DownGit > enter the URL > simply download!

Your desired download link for https://github.com/KyleMit/CodingEverything/tree/master/MVCBootstrapNavbar/Source%20Code- DOWNLOAD [this link is no more valid as the repo folder moved]

Detailed usage HERE.


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.

like image 143
Minhas Kamal Avatar answered Oct 26 '22 18:10

Minhas Kamal


no, not through a direct link.

"Loading" a folder from a git repo only means sparse checkout (partial clone).

Any other solution would indeed mean building an artifact and upload it.

Update August 2016 (2 years later): you can have a look at this answer and the DownGit project, by Minhas Kamal.

like image 45
VonC Avatar answered Oct 26 '22 20:10

VonC