Created
July 16, 2015 05:35
-
-
Save aludvigsen/647d31d9ddbc37e96345 to your computer and use it in GitHub Desktop.
Git post-receive hook deployment using node, npm and PM2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
echo "--> Restart server..." | |
pm2 restart {appname} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment