Skip to content

Instantly share code, notes, and snippets.

@fabsrc
Created November 24, 2015 13:14
Show Gist options
  • Save fabsrc/cd5c224394c174819256 to your computer and use it in GitHub Desktop.
Save fabsrc/cd5c224394c174819256 to your computer and use it in GitHub Desktop.
Simple Deployment with Git

Git Repository Deployment

Setting up Post Receive Hook (Server)

APP_DIR="/src"
mkdir $APP_DIR && cd $APP_DIR
git init

git config core.worktree $APP_DIR
git config receive.denycurrentbranch ignore

echo "#\!/bin/sh\ngit checkout -f" > .git/hooks/post-receive

chmod +x .git/hooks/post-receive

Setting up a Remote Origin (Local)

APP_DIR="/src"
USER=""
IP=""
git remote add deploy ssh://$USER@$IP/$APP_DIR

git push deploy master
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment