Skip to content

Instantly share code, notes, and snippets.

@dark-reiser
Created April 12, 2015 11:56
Show Gist options
  • Save dark-reiser/8277613ec2ba4a7f50c0 to your computer and use it in GitHub Desktop.
Save dark-reiser/8277613ec2ba4a7f50c0 to your computer and use it in GitHub Desktop.
git hook deploy
  1. create repositories
git init --bare weduz.git
  1. create web directori
mkdir /var/www/weduz

3.enter hook directory

cd weduz.git/hooks/
  1. create file
nano post-receive
  1. write this code
#!/bin/sh
git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f
  1. change permission
chmod +x post-receive
  1. clone it on local machine
git clone ssh://[email protected]/var/repo/weduz.git
  1. add some files and push
nano index.php
git add index.php
git commit -m 'add index file'
git push
  1. check on work tree
cd /var/www/weduz
ls
  1. if there is file index.php then job has done :p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment