Skip to content

Instantly share code, notes, and snippets.

@rafi
Created March 25, 2010 19:34
Show Gist options
  • Save rafi/344011 to your computer and use it in GitHub Desktop.
Save rafi/344011 to your computer and use it in GitHub Desktop.
Deploying with Git
mkdir ~/git/website.git && ~/git/cd website.git
git init --bare
mkdir ~/webapps/website
git config core.bare false
git config core.worktree /home/rafi/webapps/website ; NO TRAILING SLASH!!! Will screw up things real bad.
git config receive.denycurrentbranch ignore
; create a hook
cat > hooks/post-receive
#!/bin/sh
git checkout -f
; make it executable
chmod +x hooks/post-receive
; on client
git remote add web user@service:git/website.git
git push web +master:refs/heads/master
; to update worktree submodules
git --git-dir=~/git/website.git submodule update --init
#!/bin/sh
git checkout -f
@rafi
Copy link
Author

rafi commented Jul 10, 2014

Added an Ansible example of this at https://gist.github.com/rafi/a7ecce7d008782175b95

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