I am having trouble running the post-receive hook as follows:
#!/bin/sh
unset $(git rev-parse --local-env-vars)
cd ~/commodity
git pull origin master
bundle install
bundle exec rake assets:precompile
thin restart
I am pushing from local to remote and I am getting this error:
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 319 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: From /var/www/html/test
remote: * branch master -> FETCH_HEAD
remote: Updating a06129c..c3c3da3
remote: hooks/post-receive: line 19: bundle: command not found
remote: hooks/post-receive: line 20: bundle: command not found
remote: hooks/post-receive: line 21: thin: command not found
error: cannot run hooks/post-receive: No such file or directory
When I clone my repository on the server and push, the hook runs and everything is great. Any ideas why the push wont trigger the bundle commands when pushing from my local machine?
Thanks!
Try to add this line to your post-receive hook (at least before your first bundle ...
call):
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
On Unix systems, rvm adds this line automatically to the ~/.bash_profile
. In any none-bash contexts (crontab, git hooks) you have to add it manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With