Skip to content

prameshbhattarai/github-folder-downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ GitHub Folder Downloader (No Cloning Required)

A lightweight Bash script to download a specific folder, single file, or entire repository from GitHub β€” without the need to clone the whole project. Perfect for grabbing just the parts of a repo you actually need.


✨ Features

  • πŸ“ Download specific folders from any public GitHub repository
  • πŸ“„ Download individual files
  • πŸ“¦ Optionally download the full repository
  • πŸ” Uses a GitHub Personal Access Token (via .env) for authenticated API access
  • 🧠 Smart URL parsing β€” automatically detects folder, file, or repo URL

πŸ”§ Requirements

Make sure the following tools are installed:


πŸ› οΈ Setup

1. Copy the Script

Copy the script from this URL:

https://github.com/prameshbhattarai/GitHub-Folder-Downloader/blob/main/github-download.sh

Save it locally (e.g., as github-download.sh).

2. Create a .env File

In the same directory as the script, create a .env file to store your GitHub token:

touch .env

Add the following line to the file (replace with your actual token):

GITHUB_TOKEN=ghp_your_token_here

You can generate a token from your GitHub account settings in https://github.com/settings/personal-access-tokens

⚠️ Keep your .env file private. Do not commit it to version control.


πŸš€ Usage

Run the script with any GitHub URL (folder, file, or repository):

sh github-download.sh <GitHub URL>

πŸ§ͺ Examples

1. πŸ“ Download a Folder

⚠️ Note: Downloading large folder may exceed GitHub API rate limits.

sh github-download.sh https://github.com/owner/repo-name/tree/main/path/to/folder

2. πŸ“„ Download a File

sh github-download.sh https://github.com/owner/repo-name/blob/main/path/to/file.txt

3. πŸ“¦ Download the Entire Repository

⚠️ Note: Downloading large repositories may exceed GitHub API rate limits.

sh github-download.sh https://github.com/owner/repo-name

πŸ“Œ Tips

  • Works with public repositories only.
  • For better performance and to avoid rate-limiting, use a GitHub token.
  • Use .gitignore to avoid committing .env.

About

GitHub Folder Downloader (Without Cloning)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages