krkr
2/12/2015 - 12:09 AM

Prepare git repo with push and update

Prepare git repo with push and update

# curl -sSL https://gist.github.com/thbkrkr/... | sh -s ops.git

repo=$1

[ ! -d $repo ] \
  && mkdir $repo && cd $repo \
  && git init && git config receive.denyCurrentBranch ignore \
  && echo '#!/bin/sh' > .git/hooks/post-receive \
  && echo "GIT_WORK_TREE=$repo git checkout -f" >> .git/hooks/post-receive \
  && chmod u+x .git/hooks/post-receive \
  || echo "$repo is ready"