Skip to content

Instantly share code, notes, and snippets.

@dibmartins
Created January 25, 2017 13:35
Show Gist options
  • Save dibmartins/ef6688bda1b9e9056d3db9491247cefd to your computer and use it in GitHub Desktop.
Save dibmartins/ef6688bda1b9e9056d3db9491247cefd to your computer and use it in GitHub Desktop.
Deploy with git bare
sudo su
cd /var
mkdir repo && cd repo
mkdir site.git && cd site.git
git init --bare
cd hooks
cat > post-receive
#!/bin/sh
git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f
chmod +x post-receive
// Add remote on your local project
git remote add live ssh://user@mydomain.com/var/repo/site.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment