How to setup a non-bare git repository

mkdir repo
cd repo
git init
git config receive.denycurrentbranch ignore
echo 'git --work-tree=.. checkout -f' >>.git/hooks/post-receive
chmod a+x .git/hooks/post-receive

Posted on November 28, 2016