Skip to content

Instantly share code, notes, and snippets.

@kevbook
Created December 24, 2019 19:10
Show Gist options
  • Save kevbook/ebe641b7cdadc1834b97d05e971b0c75 to your computer and use it in GitHub Desktop.
Save kevbook/ebe641b7cdadc1834b97d05e971b0c75 to your computer and use it in GitHub Desktop.
Github repos with NPM

Authenticate by logging in to npm

  • USERNAME is your GitHub username
  • TOKEN is your personal access token
$ npm login --registry=https://npm.pkg.github.com
> Username: USERNAME
> Password: TOKEN
> Email: PUBLIC-EMAIL-ADDRESS

Edit the package.json file, add publishConfig

"publishConfig": {
  "registry":"https://npm.pkg.github.com"
}

Edit the package.json file, add repository. The field must match the URL for your GitHub repo.

"repository": {
  "type": "git",
  "url": "https://github.com/kevbook/node-namespace-matcher.git"
}

Publish the package

$ npm publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment