How To Download A Folder From Github

Download with Git

Create GitHub Resource Download Link (git-github-direct-zip-directory-folder-file) - MinhasKamal/DownGit.

You can't do it. Unlike Subversion, where each subdirectory can be checked out individually, Git operates on a whole-repository basis. For projects where finer-grained access is necessary, you can use submodules -- each submodule is a separate Git project, and thus can be cloned individually.

But if a project wasn't configured so from the beggining, you're not able to do it.

Solution

To download a folder, we are not going to use Git, we are going to use SVN instead, yes ! Subversion will do the trick for you, just follow the following steps (you need to have svn installed on your machine and svn environment variable needs to be available in the command prompt):

1) If you are a windows user

If you don't have SVN installed on your machine, download Tortoise SVN and install in your desktop from here. Remember to enable the use of tortoise svn in the command line.

In your windows command prompt, if an alert says that svn is not defined, you need to declare a environment variable with the following value in the System Environment Variables, go to control panel > system and security > system > Environment variables > new

Now we are going to simply use the svn checkout command from the command prompt, in this example, we are going to download the following folder from a xamarin repository. This repository has too many things that i don't need, and i cannot download a .zip file from this folder, therefore we are going to use subversion to clone only this folder.

Original url : https://github.com/xamarin/xamarin-forms-samples/tree/master/Todo

Github

How To Download A Folder From Github Windows 10

Now, the svn checkout command will expect :

But if you try to checkout with the normal URL, svn will not found any repo there. To fix this, you only need to replace tree/master from the url and replace it with trunk.

Final url : https://github.com/xamarin/xamarin-forms-samples/trunk/Todo

Finally, try executing the previous command with the final url :

And everything should be now located in the folder where you executed the command.

Final recommendations

How To Download A Folder From Github Windows 7

  • If you use svn export <url> instead of svn checkout <url>, you'll get a clean copy of the folder without extra git repository files.
  • Use svn ls <url> to list all available tags and branches before downloading if you want.