Skip to content

Instantly share code, notes, and snippets.

@TheSainEyereg
Created March 12, 2025 10:35
Show Gist options
  • Select an option

  • Save TheSainEyereg/e97ded313951f43fc1886207821a01d5 to your computer and use it in GitHub Desktop.

Select an option

Save TheSainEyereg/e97ded313951f43fc1886207821a01d5 to your computer and use it in GitHub Desktop.
Using private packages from GitHub Packages

Using private packages from GitHub Packages

  1. Generate personal token with read:packages permission
  2. Login to GitHub Packages registry
npm login --scope=@YourOrg --registry=https://npm.pkg.github.com
  1. Enter your GitHub username in lower case as Username and personal token as Password.
  2. Now you can simply install any private package from the @YourOrg scope like:
yarn add @YourOrg/private-package
# or
npm i @YourOrg/private-package

Using private packages from GitHub Packages with GitHub Actions

  1. Navigate to package settings at https://github.com/orgs/YourOrg/packages/npm/private-package/settings and add dependent repository to Actions access
  2. Create or update .npmrc file with registry for private packages scope @YourOrg:registry=https://npm.pkg.github.com
  3. Set workflow token permission for packages to read or write (inherits read) or assign read-all/write-all to all permissions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment