1

I have created a nodejs service that uses https://github.com/steveukx/git-js package.

When launching my service with node index.js; everything works fine.

When using PM2 ( https://github.com/Unitech/pm2) to launch my service I always got the following issue

57| | Permission denied (publickey).
57| | fatal: Could not read from remote repository.
57| | Please make sure you have the correct access rights
57| | and the repository exists.

For info; I have setted up an SSH connection from my VPS to GITHUB. My ssh keys are on ~/.ssh/

I assume that PM2 does not access properly to my directory but I still can not figure out how to configure it.

Any help will be much appreciated; Regards, Alex

aorfevre
  • 5,034
  • 3
  • 21
  • 51

1 Answers1

1

There are a few parameters that you need to use when generating the pm2 init script

$ pm2 --help | grep -i user
    -u --user <username>                             define user when generating startup script
$ pm2 --help | grep -i home
    --hp <home path>                                 define home path when generating startup script

So once you set these parameter while generating your init script, the problem should not come

References:

How to run pm2 so other server users are able to access the process?

How do you use pm2 startup with a non-root user?

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265