Unitech / pm2-deploy

Deploy part of PM2
http://pm2.keymetrics.io/docs/usage/deployment/
MIT License
178 stars 71 forks source link

Deploy, but get Not a git repository failed #23

Open leijing7 opened 10 years ago

leijing7 commented 10 years ago

I ran the setup successfully. After I changed some code, I want to update the server side, but got

    --> Deploying to production environment
    --> on host 104.131.*.*
     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

So I have to use

    pm2 deploy eco.json prodcution exec "git pull"

to get it done. The exec works, but I would like to use the update as well.

Below is the eco.json file. I only use the production part.


{
  "apps" : [{
    "name"      : "API",
    "script"    : "app.js",
    "env": {
      "COMMON_VARIABLE": "true"
    },
    "env_production" : {
      "NODE_ENV": "production"
    }
  },{
    "name"      : "WEB",
    "script"    : "web.js"
  }],
  "deploy" : {
    "production" : {
      "user" : "user",
      "host" : "104.131._._",
      "ref"  : "origin/master",
      "repo" : "https://name:pass@bitbucket.org/name/pro.git",
      "path" : "/home/user/pm2test",
      "post-deploy" : "pm2 startOrRestart ecosystem.json --env production"
    },
    "dev" : {
      "user" : "node",
      "host" : "212.83.163.1",
      "ref"  : "origin/master",
      "repo" : "git@github.com:repo.git",
      "path" : "/var/www/development",
      "post-deploy" : "pm2 startOrRestart ecosystem.json --env dev"
    }
  }
}
Unitech commented 10 years ago

Once you did the git pull, does pm2 deploy production works?

leijing7 commented 10 years ago

haven't tried it again yet. i will give it a go then let you know.

leijing7 commented 10 years ago

I finally did it again. It's on a Raspberry Pi. After 'git pull', the 'deploy production' command works.

chrisinajar commented 9 years ago

I am also having this issue, however after the exec "git pull" the output remains the same and it never launches the application (or the PM2 daemons or anything, it just creates the folders)

Initializing the PM2 daemon on that server also has no affect.

fernandoneto commented 9 years ago

I think i found the problem. Im having the same problem and i start diginig around and found a diff in deploy script. In this repo you have this. repo

but in my instance i have this

versao no dev

i have the latest version of pm2. the version of pm2-deploy in instance is the same of repo version

version git

so i edit the deploy script according with what you have in github and it work just fine.

perhaps you've forgotten to make the publication in npm

t0lkman commented 5 years ago

the solution above worked for me. When this code changes will be available in pm2?

vaishnavi-naik commented 3 years ago

Tried pm2 deploy eco.json production exec "git pull", did not work.

Try this: https://stackoverflow.com/a/68417902/7397707 Use --force.

pm2 deploy ecosystem.config.js production --force

PM2 Deploy Documentation

Note: if git report an error that there are local changes but still want to push what is on the remote GIT, you can use the --force option to force deployment.

mfn commented 2 years ago

See also https://github.com/Unitech/pm2-deploy/issues/193#issuecomment-1137773493 for similar issue but different reason (git not working properly).