Npm install private repo

I’m trying to npm install a package.json that contains a module that is a private Github module.

I have generated a personal access token with repo privileges and added that as a secret.

Then in package.json the private repo module dependency looks like this:

"<module-name>": "git+https://$[username]/[repo-name].git"

The action runs and the logs show the env variable is being set in the workflow step:


However I’m getting this error in the GitHub action:

npm ERR! Error while executing:

npm ERR! /usr/bin/git ls-remote -h -t ***[username]/[repo-name].git

npm ERR!

npm ERR! remote: Repository not found.

npm ERR! fatal: repository ‘[username]/[repo-name].git/’ not found

npm ERR! exited with error code: 128

When I copy and paste the url into a browser, the repo is definitely there as it loads in the browser.

What am I missing?

1 Like

By the way…

I got the syntax from this SO post: