0

Whenever I try to install using npm install from a package that is loaded on a git repository (on windows) it fails:

2494 error An unknown git error occurred
2495 error command git --no-replace-objects ls-remote ssh://git@<SIT>/P_0001_PI/config-loader.git
2496 error <SITE>: Permission denied (publickey).
2496 error fatal: Could not read from remote repository.
2496 error
2496 error Please make sure you have the correct access rights
2496 error and the repository exists.
2497 verbose exit 128

However I already added an ssh key using ssh-keygen as well as make the openssh authenticator service run automatic. (and add the key to the keychain).

Originally git itself also gave the problem, however this was solved by adding GIT_SSH environment variable to the user environment variables (with as value to location of window's openssh executable).

whenever I run the command

git --no-replace-objects ls-remote ssh://git@/P_0001_PI/config-loader.git

From command line directly it works (without asking for the passphrase, as expected). However when running npm install the above error pops up.

paul23
  • 8,799
  • 12
  • 66
  • 149

1 Answers1

0

I guess I am late but just in case anyone sees this:

Please open your cmd in your repo and run where ssh-agent and where ssh-add to test which ssh path will be preferred. If everything is set properly, you should see same path. If you see multiple paths for each commands, the path that appears first will be preferred. I had similar issue, I managed to resolve it using my approach here: https://stackoverflow.com/a/63173335/14021241.

If you think your approach should resolve the issue as well, just make sure in Environment Variables you add the paths in the correct order. :)

Sanidhya Gaur
  • 301
  • 3
  • 7