基本上我想:
git --work-tree=/home/aero/server --git-dir=/home/aero/server/.git pull;
ps aux | grep node | grep server-aero-static | awk '{print $2}' | xargs kill -9;
cd /home/aero/server;
npm start;我不认为这会在post-receive中工作,为什么?我怎么才能让它工作呢?
发布于 2019-03-28 13:48:09
如果在/home/aero/server中正确设置了远程“源”,以便存储库正常工作(如"Git post-receive not working correctly"),则Git部分应该可以工作。
如果命令阻塞,npm start部分可能会出现问题。
在这种情况下(意味着在Git钩子中执行),您可以考虑使用using 来启动您的应用程序,如的"A Friendly Guide To Automate Deployment For Node.js Apps With Git Hooks“中所述。
pm2 start npm --name 'my-app' — start \
&& echo "post-receive: app started successfully with pm2".https://stackoverflow.com/questions/55389305
复制相似问题