Skip to content

Instantly share code, notes, and snippets.

@aludvigsen
aludvigsen / gist:647d31d9ddbc37e96345
Created July 16, 2015 05:35
Git post-receive hook deployment using node, npm and PM2
#!/bin/sh
export GIT_WORK_TREE="/var/www/project"
echo "--> Checking out..."
git --work-tree=$GIT_WORK_TREE --git-dir=/var/repos/myrepo.git checkout -f
echo "--> NPM install..."
cd "$GIT_WORK_TREE"
npm install