NoGit is a PowerShell module that downloads the contents of a GitHub repository without requiring git to be installed. It uses the GitHub REST API and a personal access token (PAT) to retrieve files and folders recursively from any branch or path and saves them locally.
- 🔒 Uses secure GitHub fine-grained personal access tokens (PAT)
- 📂 Recursively downloads full repository contents
- 📁 Saves to any local directory with auto-creation
- 🎯 Supports targeted downloads with
-SourcePath - 🚫 No dependency on
git
Install-Module NoGit -Scope CurrentUser -Forceℹ️ Note: If you cannot install this module, run the command below and press Enter. You can then run
Get-NoGitHubRepoTreeContents.
iex (irm 'https://raw.githubusercontent.com/kevinblumenfeld/NoGit/main/module/NoGit/Public/Get-NoGitHubRepoTreeContents.ps1')
#To use the commands, identify the Owner and Repo from the GitHub URL:
https://github.com/Owner/Repo
└────┘└───┘
-Owner -Repo
Get-NoGitHubRepoTreeContents -Token 'ghp_...' -Owner 'octocat' -Repo 'Hello-World' -TargetDir 'C:\Temp\Hello-World' -VerboseGet-NoGitHubRepoTreeContents -Token 'ghp_...' -Owner 'octocat' -Repo 'Hello-World' -TargetDir 'C:\Temp\Hello-World' -SourcePath 'src/module' -Verboseℹ️ Note: The
-Branchparameter is optional and defaults to"main".
What does -SourcePath do?
- It filters the download to only include files and folders under the path you specify.
- It downloads everything inside that folder recursively, including all its subfolders and files.
- The folder itself is not included in your local download. Only its contents are placed inside your target directory.
For example:
If you set:
SourcePath = 'Build/DTect'TargetDir = 'C:\Temp\DTect'
Then a file like: Build/DTect/0.0.637/file.psd1
...will be saved locally as: C:\Temp\DTect\0.0.637\file.psd1
✅ Note: Any directory in the repository matching
SourcePathwill be downloaded.
Get-NoGitHubRepoContents -Token 'ghp_...' -Owner 'octocat' -Repo 'Hello-World' -TargetDir 'C:\Temp\Hello-World' -Branch 'feature-x' -VerboseVERBOSE: Created directory: C:\Code\Hello
VERBOSE: Downloaded: README.md
VERBOSE: Downloaded: src/main.ps1
VERBOSE: --- Summary for octocat/Hello-World ---
VERBOSE: Success : 2
VERBOSE: Fail : 0
VERBOSE: OutputDir : C:\Code\Hello
VERBOSE: Elapsed : 00:00:05
- PowerShell 5.1 or later (7+ recommended)
- GitHub fine-grained personal access token (PAT) with
repo contents:readpermission
Contributions are welcome. Open issues, suggest improvements, or submit a PR.
- Parallel processing implementation for faster downloads of large repositories
- Pester tests for publishing automation
Licensed under the MIT License.