Download specific files from github in command line, not clone the entire repo

前端 未结 5 969
灰色年华
灰色年华 2021-02-05 09:18

How do I download just 2 files from github using command line ?
Something in the lines of :

git fetch git://github.com/username/Project.git/file1
git fetch          


        
5条回答
  •  生来不讨喜
    2021-02-05 10:21

    You can try github-files-fetcher, it is a command line tool which downloads a single folder or file from a GitHub repo.

    Given the example above, you can use the following command to fetch the two specific files from github:

    fetcher --url="git://github.com/username/Project.git/file1" 
    fetcher --url="git://github.com/username/Project.git/file2" 
    

    Think a more real scenario: you were visiting the following webpage page and wanna download the async subdirectory alone.

    https://github.com/reduxjs/redux/tree/master/examples

    sorry for not being allowed to post images.

    With The github-files-fetcher, you should first copy the url of that page, which is https://github.com/reduxjs/redux/tree/master/examples/async, and then run the command below in command line:

    fetcher --url=https://github.com/reduxjs/redux/tree/master/examples/async

提交回复
热议问题