所以我想出了如何在 bash 脚本中永远运行,在 filezilla 中我将 /usr/local/lib/node_modules/forever
的所有权限更改为 777。
接收后 bash 脚本
#!/bin/sh
git --work-tree=/var/www/example.io/public_html --git-dir=/var/repo/example.git checkout -f
/usr/local/lib/node_modules/forever restart ../../../www/example.io/public_html/server.js
然后,当我推送时,它会成功写入,但我得到了这个
remote: hooks/post-receive: 3: hooks/post-receive: /usr/local/lib/node_modules/forever: Permission denied
既然我将所有文件夹更改为 777,我还能做什么?
最佳答案
所以在 bash 脚本中,forever 命令的工作方式就像这样
forever restart server.js
不涉及路径,唯一需要注意的是它会重新启动所有 server.js 进程,因此我需要相应地命名我的 Node 服务器。
还将我的远程服务器更改为 root。现在一切正常。
关于javascript - 权限被拒绝,forever.js 作为 bash 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28420832/