Can't npm install GitHub Repository - Get error Permission denied (publickey).

Hi Everyone!

I have been trying to figure out how to successfully install an npm package hosted on my Github account. It works locally on my mac but not from my Digital Ocean Droplet.

Here are the guides I have looked at it and tried:

and several others!

Nothing works.

I regenerated new keys and uploaded them to GitHub but still nothing.

The command I am trying to run is:

npm install git+ssh://

I get:

35 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "git+ssh://"
36 verbose node v10.16.0
37 verbose npm  v7.18.1
38 error code 128
39 error command failed
40 error command git --no-replace-objects ls-remote ssh://
41 error Permission denied (publickey).
41 error fatal: Could not read from remote repository.
41 error
41 error Please make sure you have the correct access rights
41 error and the repository exists.
42 verbose exit 128

here are the permissions on my .ssh directory

drwx------ 2 root root 4096 Feb  1 21:21 .
drwx------ 9 root root 4096 Jun 18 22:34 ..
-rw-r--r-- 1 root root  103 Jun 19 16:33 authorized_keys
-rw------- 1 root root  411 Jun 18 18:59 id_ed25519
-rw-r--r-- 1 root root  103 Jun 18 18:59
-rw-r--r-- 1 root root 1548 Jun 18 18:26 known_hosts

My apologies if I missed to share something more fundamental. Any help would be highly appreciated!


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi there @avansardar,

As discussed below, the fix was to upgrade the Node version from v10.x to v14.x as per this tutorial here.

The setup actually looks all good. What I could suggest is to try to SSH to GitHub by adding the -v argument to see some debug messages:

ssh -vvv

Feel free to share the output here.

Alternatively, I would recommend using HTTP rather than SSH to install the package:

npm install git+

Let me know how it goes! Regards, Bobby