One-click setup for GitHub Packages npm registry auth. No more annoying 403 errors when installing private packages during local development.
- Auto-detects and installs
ghCLI if not present (macOS/Linux/Windows) - Runs
gh auth loginwithread:packages,reposcopes (interactive GitHub auth) - Prompts for org scopes — enter one or more (e.g.
@theplant @my-org) - Writes
~/.npmrcwith the correct registry and auth token, sonpm installjust works
npx ghtkghtkYou'll see an interactive flow:
🔧 GitHub Packages npm registry configurator
✅ gh CLI is available.
Enter the GitHub org scopes to configure for npm.pkg.github.com.
You can enter one or more scopes separated by spaces.
Example: @theplant @my-org
Scopes: @theplant @another-org
After completing GitHub auth, your ~/.npmrc will be configured:
@theplant:registry=https://npm.pkg.github.com
@another-org:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=ghp_xxxxxxxxxxxxAuto-install gh CLI support:
- macOS — via Homebrew (
brew install gh) - Linux (Debian/Ubuntu) — via apt
- Linux (Fedora/RHEL/CentOS) — via dnf
- Windows — via winget
npm testMIT