Created
November 2, 2017 16:38
-
-
Save bbarrows/d677d1717468163f16d7f3834a78166e to your computer and use it in GitHub Desktop.
Setting Up Git Push And Server Pull Hook
This file contains hidden or 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
GitHookPushToServer | |
https://stackoverflow.com/questions/24382150/git-hook-make-server-pull-after-i-push-to-github | |
cd ~/example && mkdir .git && cd .git && git init --bare | |
cat > hooks/post-receive << EOF | |
> #!/bin/sh | |
> GIT_WORK_TREE=~/example git checkout -f | |
> EOF | |
chmod +x hooks/post-receive | |
git remote add server ssh://my_user@my_server.com:/absolute_path/example/.git/ | |
git push server +master:refs/heads/master | |
cd ~/example && mkdir .git && cd .git && git init --bare | |
cat > hooks/post-receive << EOF | |
#!/bin/sh | |
GIT_WORK_TREE=~/example git checkout -f | |
EOF | |
chmod +x hooks/post-receive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment