Skip to content

Instantly share code, notes, and snippets.

@alkavan
Forked from rafi/post-receive
Last active September 4, 2015 18:05
Show Gist options
  • Save alkavan/362377 to your computer and use it in GitHub Desktop.
Save alkavan/362377 to your computer and use it in GitHub Desktop.
Deploy with git
mkdir ~/git/website.git && cd ~/git/website.git
git init --bare
mkdir ~/webapps/website
git config receive.denycurrentbranch ignore
git config core.bare false
git config core.worktree ~/webapps/website ; NO TRAILING SLASH!!! Will screw up things real bad.
; create a hook
nano hooks/post-receive
; put this inside
#!/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 (run in worktree dir)
git --git-dir=~/git/website.git submodule update --init
#!/bin/sh
; the bestest greatest hook script for kohana
git checkout -f
sed -i 's/\/bpii/\/clients\/bpii_n/g' /home/rafi/webapps/atraxia/clients/bpii_n/.htaccess
sed -i "s/'default'/'dev'/g" /home/rafi/webapps/atraxia/clients/bpii_n/application/config/database.php
sed -i "s/'production'/'default'/g" /home/rafi/webapps/atraxia/clients/bpii_n/application/config/database.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment