-
Notifications
You must be signed in to change notification settings - Fork 0
How to set up Git Hooks
Hello, I'm going to write down what I just did for setting up Git Hooks for daishodesign.com.
Create a directory site-daishodesign.git
under /var/repo/
Initiate with bare flag
git init --bare
The commande above should have created the directory hooks/
.
Navigate into it.
Create it under hooks/
sudo nano post-receive
Open it with nano then add this line.
#!/bin/sh git --work-tree=/var/www/daishodesign.com/html --git-dir=/var/repo/site-daishodesign.git checkout -f
Create symlink from server block file to a directory sites-enabled
sudo ln -s /etc/nginx/sites-available/daishodesign.com /etc/nginx/sites-enabled/
Give execution permissions to post-receive
file
sudo chmod +x post-receive
Go back to local, then add a production remote
git remote add production ssh://root@daishodesign.com/var/repo/site-daishodesign.git