pm2-deploy: stuck on deploy step

Hi there,

I am trying to use the pm2 deploy feature but getting stuck on step 2 - deployment. I’ve run the setup command which successfully clones the repo but the next command throws the following error:

Edit: Works fine when using visionmedia/deploy directly.

--> Deploying in development environment on host 192.168.x.x
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>

  commit or stash your changes before deploying

1

Config file:

{
  "apps" : [{
    "name"      : "xxx",
    "script"    : "./server/app.js",
    "env_development": {
      "NODE_ENV": "development",
      "NPM_PORT": 3000,
      "NPM_HOST": "0.0.0.0",
      "NPM_DB-URL": "localhost/cmp"
    },
    "args": "['--harmony']"
  }],
  "deploy" : {
    "development" : {
      "user" : "user",
      "host" : "192.168.x.x",
      "ref"  : "v0.1.3",
      "repo" : "git@bitbucket.org:hidden/hidden.git",
      "path" : "$HOME/xxx",
      "post-deploy" : "pm2 startOrRestart ecosystem.json && pm2 save"
    }
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

it seems that this bug came back with 2.4.0, It’s also solved for me if I cwd to $path/source

Same issue(

so how to fix the issue?

www-data@vps:~/tools$ pm2 deploy --version
3.2.9

Same issue here.

jenkins@alentame-server:~$ pm2 deploy ecosystem.json production setup
--> Deploying to production environment
--> on host localhost
  ○ running setup
  ○ cloning git@github.com:trentosoftware/futbol-amateur.git
Cloning into '/home/deploy/alentame-web/source'...
  ○ setup complete
--> Success

And then…

jenkins@alentame-server:~/workspace$ pm2 deploy ecosystem.json production 
--> Deploying to production environment
--> on host localhost
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>

  commit or stash your changes before deploying

Deploy failed

ecosystem.json:

{
  "apps" : [
    {
      "name"      : "alentame",
      "script"    : "server/bin/www.js",
      "env": {
        "COMMON_VARIABLE": "true"
      },
      "env_production" : {
        "NODE_ENV": "production"
      }
    }
  ],

  "deploy" : {
    "production" : {
      "user" : "deploy",
      "host" : "localhost",
      "ref"  : "origin/master",
      "repo" : "git@github.com:trentosoftware/futbol-amateur.git",
      "path" : "/home/deploy/alentame-web",
      "post-deploy" : "pm2 startOrRestart ecosystem.json --env production"
    }
  }
}

I have two users on the same machine. I want my jenkins user to run pm2 deploy command in order to let deploy user to do his job.

Any ideas?