Can't install npm package from private github repo

This is a duplicate of an old thread: Npm install private repo with deploy key. Reviving because it is still an issue with Circle CI.

Quite simply, here’s what I’m trying to do:

"dependencies": {
  "bar": "git://"

We’re using a npm package that needs to remain private, so we’re trying to host it on our GitHub org (it’s the pro fontawesome packages, after they nuke your registry access, if anyone comes here for the same reason). It works if you try to npm install them from your machine, but circleCI chokes and shows the following error:

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t
npm ERR! 
npm ERR! remote: Invalid username or password.
npm ERR! fatal: Authentication failed for ''
npm ERR! 
npm ERR! exited with error code: 128

I tried adding deploy keys in GitHub and the SSH key in Circle CI, but it does not seem to work.

The workaround, as explained in this article, is to use a personal access token committed to our repo, which is bad.

Have you tried this?

"dependencies": {
  "bar": ""

I believe you just need to use the format you would find when you click “Code” in the Github repo UI and select the Clone -> SSH option.

1 Like