1

Scenario:

  • I have developed a node module of some sort.
  • Later on I came to know, instead of publishing my node module to the npm repository, I could use my own Gitlab repo to serve it as a node module.

Constraints are:

  • I have to use the private repo for this activity
  • I have to use the https url for fetching the repo

So after googling for a couple of hours, I landed upon a solution, which involved including the dependecy directly from the git repository.

Thus my dependency looks like:

    "my-module": "git+https://myusername:myaccesstoken@gitlab.com:Organization/Project.git#develop"

If I execute npm install it would result in:

npm ERR! Error while executing: npm ERR! /usr/bin/git ls-remote -h -t ssh://git@gitlab.com/organization/project.git npm ERR! npm ERR! Permission denied (publickey). npm ERR! fatal: Could not read from remote repository. npm ERR! npm ERR! Please make sure you have the correct access rights npm ERR! and the repository exists. npm ERR! npm ERR! exited with error code: 128 npm ERR! A complete log of this run can be found in: npm ERR! /home/username/.npm/_logs/2018-05-16T13_25_37_053Z-debug.log

tsumit
  • 312
  • 2
  • 10

1 Answers1

0

Assuming you followed the steps to setup an access token as mentioned in this SO answer

can you try removing the .git extension at the end of the project url, so it should look like

"my-module": "git+https://myusername:myaccesstoken@gitlab.com:organization/project#develop"

so everything after @ should be the exact URL of the project on gitlab as you see in the address bar

dexter
  • 13,365
  • 5
  • 39
  • 56