Use https://github.com/bisquit/ghget-cli instead.
Download a directory or file from a repository URL you are viewing:
- Single command, any URL
- Support both GitHub and GitLab
- Cross platform (macOS, Windows)
The corresponding CLI must be installed and authenticated.
- For GitHub, install GitHub CLI
- then
gh auth login
- then
- For GitLab, install GLab
- then
glab auth login
- then
You only need to install what you use.
Why install CLI?
This tool uses GitHub or GitLab rest api to fetch repository archive. It is possible to authenticate with an access token, but an additional token must be issued, which must then be passed to the tool.
To keep it simple and robust, we are taking advantage of the CLI's authentication feature.
You can quickly try with npx
npx rpget@latest https://github.com/bisquit/rpget/tree/main/sample
or install globally
npm i -g rpget
yarn global add rpget
pnpm add -g rpget
Hit rpget <url>
.
rpget https://github.com/bisquit/rpget/tree/main/sample
See examples.
This tool fetches archive(.zip) with API, and after user confirmed, decompresses it and copies into current directory.
Because branches can include /
, we cannot distinguish the URL main/src
is which:
- a)
main/src
branch - b)
main
branch andsrc
directory
So it attempts to fetch archive with "possible refs" (in this case, main
and main/src
) concurrently.
It takes a bit networking cost, but works faster than git clone
.
This tool is initialy inspired by
While these are primarily intended for scaffolding, this tool is designed for getting a portion of the repository.
Also I aimed for intuitive commands you don't need to remember how to specify.