Created
February 25, 2014 13:27
-
-
Save iamdionysus/9208687 to your computer and use it in GitHub Desktop.
post-receive hook under /hooks in order to automate deploy on the server master branch. git push origin master invokes post-receive hook below after the push has been done. Then the code below will be executed which make repository on a server pull the change automatically.
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/sh | |
unset GIT_DIR | |
cd /my/git/project/on/server && git pull origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the key is unset GIT_DIR since under the hook execution, GIT_DIR will be set as the directory which is on. In higher version git, after the unset, git -C /my/git/project/on/server pull origin master should be fine.