Download a Subfolder or File from a Github Repository
Sometimes we need to download a directory/subdirectory of a Github repository. In that case, let’s follow the easiest way:
Download a Directory
Using Command Line
- Find the url of the directory. It can be something like
https://github.com/susanli2016/Machine-Learning-with-Python/tree/master/data
. - Now, replace the
tree/master
withtrunk
https://github.com/susanli2016/Machine-Learning-with-Python/tree/master/data
$\rightarrow$
https://github.com/susanli2016/Machine-Learning-with-Python/trunk/data
-
Now download the folder using SVN
$ svn checkout https://github.com/susanli2016/Machine-Learning-with-Python/trunk/data
Using Online Tools
Checkout the following online tools
- Download Directory
- DownGit
- GitZip
Download a Single File
The simplest way is
- Get the URL
- Choose the
raw
view - And save the file by right clicking on the mouse and selecting
save as
Or using the command line, use wget
$ wget
https://raw.githubusercontent.com/jquery/jquery/master/src/ajax.js
Or you can use the above-mentioned online tools to download an individual file.
That’s it for today! Cheers!!!
References
- https://stackoverflow.com/questions/7106012/download-a-single-folder-or-directory-from-a-github-repo
Leave a comment