Last Updated: August 16, 2016
· janosgyerik

How to download a project subdirectory from GitHub

If you want to download an entire project from GitHub without version control data, you can use the Download ZIP option of the website. Alternatively, you could use command line tools, for example:

curl -L https://github.com/janosgyerik/jquery-upvote/tarball/master > project.tar.gz

What if you want to download only a subdirectory? The website doesn’t have an option for that, at least not yet. Not a problem! Thanks to Subversion support in GitHub, you could use the svn command line tool to that effect, for example:

svn export https://github.com/janosgyerik/jquery-upvote/trunk/lib jquery-upvote-lib

This creates a directory locally with the content of the specified subdirectory of the project.

Just make sure to construct the URL correctly, using the format:

https://github.com/USER/PROJECT/trunk/PATH DEST

Inspired by the question on #stackoverflow: git export from github remote repository

Say Thanks

3 Responses
Add your response


I don't have svn/git and don't plan to install either. I just want the subdirectory. What do I do?

over 1 year ago ·

@markjeronimus If I knew how to do it without svn, I would have answered that way... Unfortunately I don't :( So you have to either download the entire repo using GitHub's own download feature, or install svn to use this hack.

over 1 year ago ·

Finally I found what i need it really helped Thanks janosgyerik

over 1 year ago ·
Filed Under