How to Download a GitHub Folder Using the SVN Trick
GitHub quietly runs a Subversion (SVN) compatibility bridge alongside its Git servers. Because of that bridge, any public repo can be addressed with an SVN URL, which means svn export can pull down a single subfolder — nothing else — directly from the command line, with no git history and no third-party tool involved.
This works because GitHub maps the word trunk in a repo URL to that repo's default branch, and maps any path after it to a folder inside the repo — a convention borrowed straight from how Subversion repositories are traditionally laid out. Point an SVN client at https://github.com/{owner}/{repo}/trunk/{path/to/folder} and GitHub's server answers as if that path were a real SVN repository, letting svn export (or svn checkout) fetch just those files. It's an unofficial but well-known and stable trick, and it's been a favorite of developers who want one folder without touching Git at all.
Step by step
-
Install an SVN client
You need a Subversion client on your machine — it's the only real requirement. Pick the command for your OS:
# macOS (Homebrew) brew install subversion # Debian / Ubuntu sudo apt install subversion # Windows # Install SlikSVN (command-line) or TortoiseSVN (GUI + shell integration) -
Run svn export against the folder URL
Open a terminal and run
svn exportagainst GitHub's trunk-style URL, substituting the real owner, repo, and folder path:svn export https://github.com/{owner}/{repo}/trunk/{path/to/folder}A concrete, worked example — grabbing just the
reactpackage out of the Facebook/Meta React monorepo:svn export https://github.com/facebook/react/trunk/packages/reactOnly the files under
packages/reactare transferred. The rest of the repository, and all of its Git history, is never touched. -
Find your downloaded folder
The command writes a plain folder — named after the last path segment, e.g.
react/— into your current directory. It's ordinary files on disk, not a ZIP archive. If you want a ZIP afterward, compress it yourself with your OS's built-in tools (right-click → Compress on macOS/Windows, orzip -r react.zip react/on Linux/macOS). -
Check out a specific branch instead of the default
Swap
trunkforbranches/{branch-name}to export from a non-default branch:svn export https://github.com/facebook/react/branches/main/packages/react-dom
The honest tradeoffs
Unlike a browser-based tool, this requires installing an SVN client first — a real, if one-time, cost if you don't already have Subversion around. GitHub's SVN bridge is also a secondary compatibility layer rather than its native protocol, so exports can occasionally be slower or more prone to rate-limiting than a plain git clone. That said, it's a genuinely useful, zero-third-party-tool trick when you already have SVN installed or work in an environment where it's standard.