less than 1 minute read

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

  1. Find the url of the directory. It can be something like https://github.com/susanli2016/Machine-Learning-with-Python/tree/master/data.
  2. Now, replace the tree/master with trunk
     https://github.com/susanli2016/Machine-Learning-with-Python/tree/master/data
    

    $\rightarrow$

     https://github.com/susanli2016/Machine-Learning-with-Python/trunk/data
    
  3. 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

  4. Download Directory
  5. DownGit
  6. GitZip

Download a Single File

The simplest way is

  1. Get the URL
  2. Choose the raw view
  3. 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

  1. https://stackoverflow.com/questions/7106012/download-a-single-folder-or-directory-from-a-github-repo

Leave a comment