【问题标题】:PM2 Node js service is not accessing SSH Keys (git)PM2 节点 js 服务未访问 SSH 密钥(git)
【发布时间】:2019-12-07 21:39:50
【问题描述】:

我创建了一个使用https://github.com/steveukx/git-js 包的nodejs 服务。

使用node index.js 启动我的服务时;一切正常。

当使用 PM2 (https://github.com/Unitech/pm2) 启动我的服务时,我总是遇到以下问题

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.

信息;我已经建立了从我的 VPS 到 GITHUB 的 SSH 连接。 我的 ssh 密钥在 ~/.ssh/

我假设 PM2 无法正确访问我的目录,但我仍然不知道如何配置它。

任何帮助将不胜感激; 问候, 亚历克斯

【问题讨论】:

  • 请提供任何线索。

标签: node.js git ssh pm2


【解决方案1】:

在生成 pm2 init 脚本时需要使用几个参数

$ 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

所以一旦你在生成初始化脚本时设置了这些参数,问题就不应该出现

参考资料:

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?

【讨论】:

    猜你喜欢
    • 2014-12-06
    • 1970-01-01
    • 2016-07-05
    • 2015-08-31
    • 2021-05-13
    • 2020-11-17
    • 1970-01-01
    • 1970-01-01
    • 2011-06-23
    相关资源
    最近更新 更多