Created
August 19, 2013 17:17
-
-
Save williamespindola/6271617 to your computer and use it in GitHub Desktop.
hook post-receive file to checkout of branch master when deploy from my localhost to the server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
docroot="/my/path/to/root/of/my/project/" | |
while read oldrev rewrev ref | |
do | |
branch=`echo $ref | cut -d/ -f3` | |
if [ "master" == "$branch" ]; then | |
git --work-tree=$docroot checkout -f $branch | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To configure it, log-in on the server via ssh
Create git bare files on my root or public_html.
Create or rename file in app.git/hook/post-receive. and put above.
After this, change permissions of post-receive file:
Create remote.
and push..