Git commit not working in pre-deploy-local
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
Supposing that in my pre-deploy-local script in the ecosystem.config.js some modification is apported to the code (for example when I build the project), I am forced to add, commit and to push these modifications so the build will be uploaded with the rest of the project on my server.
To do that I have to insert git commands in the pre-deploy-local scripts. But the command git commit has no effect and gives unpredictable errors.
In my example I have:
...'pre-deploy-local': "npm run build:ssr:production; git commit -a -m 'CSR_SSR BUILD for PRODUCTION'; git push",...
I have already tried escaping the ' symbols or using the double quotes instead of the single ones or using && instead of ; (that makes fail the entire deploy) or to separate the git commit -a with first git add . and then the git commit -m ... but nothing solves this.
The console prints out errors like this:
fatal: Paths with -a does not make sense
or
pathspec * not found
I was wondering: maybe in the pre deploy local the use of git is forbidden?
How could we reproduce this issue?
Inserting git commit and push inside the pre-deploy-local script.
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Wed Jun 19 2019 15:45:30 GMT+0200 (GMT+02:00)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 3.4.0
node version : 10.15.0
node path : /usr/local/bin/pm2
argv : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : zepping
uid : 501
gid : 20
uptime : 12min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 3.4.0
node version : 10.15.0
node path : /usr/local/bin/pm2
argv : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0 : node
user : zepping
uid : 501
gid : 20
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : darwin
type : Darwin
cpus : Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
cpus nb : 4
freemem : 1419591680
totalmem : 17179869184
home : /Users/zepping
===============================================================================
--- PM2 list -----------------------------------------------
┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/Users/zepping/.pm2/pm2.log last 20 lines:
PM2 | 2019-06-17T09:51:34: PM2 log: Concurrent actions : 2
PM2 | 2019-06-17T09:51:34: PM2 log: SIGTERM timeout : 1600
PM2 | 2019-06-17T09:51:34: PM2 log: ===============================================================================
PM2 | 2019-06-17T17:44:23: PM2 log: pm2 has been killed by signal, dumping process list before exit...
PM2 | 2019-06-17T17:44:23: PM2 log: Exited peacefully
PM2 | 2019-06-19T15:32:54: PM2 log: ===============================================================================
PM2 | 2019-06-19T15:32:54: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2 | 2019-06-19T15:32:54: PM2 log: Time : Wed Jun 19 2019 15:32:54 GMT+0200 (GMT+02:00)
PM2 | 2019-06-19T15:32:54: PM2 log: PM2 version : 3.4.0
PM2 | 2019-06-19T15:32:54: PM2 log: Node.js version : 10.15.0
PM2 | 2019-06-19T15:32:54: PM2 log: Current arch : x64
PM2 | 2019-06-19T15:32:54: PM2 log: PM2 home : /Users/zepping/.pm2
PM2 | 2019-06-19T15:32:54: PM2 log: PM2 PID file : /Users/zepping/.pm2/pm2.pid
PM2 | 2019-06-19T15:32:54: PM2 log: RPC socket file : /Users/zepping/.pm2/rpc.sock
PM2 | 2019-06-19T15:32:54: PM2 log: BUS socket file : /Users/zepping/.pm2/pub.sock
PM2 | 2019-06-19T15:32:54: PM2 log: Application log path : /Users/zepping/.pm2/logs
PM2 | 2019-06-19T15:32:54: PM2 log: Process dump file : /Users/zepping/.pm2/dump.pm2
PM2 | 2019-06-19T15:32:54: PM2 log: Concurrent actions : 2
PM2 | 2019-06-19T15:32:54: PM2 log: SIGTERM timeout : 1600
PM2 | 2019-06-19T15:32:54: PM2 log: ===============================================================================
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pre-deploy-local hook in ecosystem.config.js and inspect how PM2 executes deploy script commands. Reproduce the reported npm build, git commit, and git push sequence with the supplied PM2 and Node.js versions, then verify that valid Git commands run from the expected repository context without the reported path errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, javascript, node.js
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100