I have an "after push" webhook on GitHub that calls a CGI script to update a Jekyll website.
The script:
user@server [~/_repo]# cat cgi-bin/githook.cgi
#!/bin/bash
echo Content-type: text/plain
echo
if [ -z "$HOME" ] ; then
HOME=/home/user
fi
GIT_REPO=$HOME/_repo
PUBLIC_WWW=$HOME/public_html
pushd $GIT_REPO
git pull
echo "$HOME/.rvm/bin/ts_jekyll build --source $GIT_REPO --destination $PUBLIC_WWW"
$HOME/.rvm/bin/ts_jekyll build --source $GIT_REPO --destination $PUBLIC_WWW
popd
echo DONE
GitHub saves the output from the script as:
~/_repo ~/public_html/cgi-bin
Updating OLD_COMMIT_SHA..NEW_COMMIT_SHA
/home/user/.rvm/bin/ts_jekyll build --source /home/user/_repo/ --destination /home/user/public_html
Configuration file: /home/user/_repo/_config.yml
Source: /home/user/_repo/
Destination: /home/user/public_html
Generating...
done.
Auto-regeneration: disabled. Use --watch to enable.
~/public_html/cgi-bin
DONE
This is the output I am expecting, but the site is not updated.
When I log in with SSH and run user@server [~]# _repo/cgi-bin/githook.cgi
, I usually get the exact same output again and the site is properly updated.
If I make a change to the local copy, the web hook still appears to work (even though it shouldn't) and the version on the command line shows the appropriate message about overwriting local changes.
What could be causing this to happen?
0 Answers