7

I have a post-merge hook in my git repository that just runs the jekyll command.

When I run git pull, the post-merge runs with no problems.

However, I have setup a PHP file which will act as a WebHook for the remote:

$pull = `cd .. && git pull`;
echo $pull;

When I access this file, the git pull runs (after some initial problems) and is successful. However, for some reason the post-merge fails. If I look inside of my Apache error_log, I find the following error:

.git/hooks/post-merge: line 5: jekyll: command not found

This is odd, considering the post-merge successfully runs jekyll when I do a manual git pull via SSH.

If I run use the full path to the executable as suggested here, I get this error in my error_log:

/usr/bin/env: ruby_noexec_wrapper: No such file or directory

I installed Ruby through RVM.

How is it possible to have the apache user run jekyll with no problems?

Edit: Here is my current post-merge:

#!/bin/sh

unset GIT_DIR

source /usr/local/rvm/environments/ruby-1.9.3-p194

/usr/local/rvm/gems/ruby-1.9.3-p194/bin/jekyll

echo "Deployed!"

When I run this as the apache user, I now get this error:

Node.js is installed.

3 Answers 3

4
+25

I think this error is very clear:

jekyll: command not found

you should use the complete path to your jekyll command.

whereis jekyll

then execute the command with the full path like:

/usr/local/bin/jekyll --params

Here is a solution for the ruby_noexec_wrapper problem.

/usr/bin/env ruby_noexec_wrapper fails with no file or directory

Edit:

Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available

ExecJS and could not find a JavaScript runtime

Sign up to request clarification or add additional context in comments.

12 Comments

After adding source /usr/local/rvm/environments/ruby-1.9.3-p194 to my post-merge (see here), I’m now getting this error. I think it’s because jekyll has plugins which are requiring gems, and they would need sourcing too… right?
You should first look at the first error: Could not find a JavaScript runtimehttps://github.com/sstephenson/execjs the gem is missing. So you should follow this post: stackoverflow.com/questions/6282307/…
Hmm, if I run jekyll via SSH, I have no problems. I think I might have the gem, it’s just not got access?
I don't know what you do ;) but he can't find the JS runtime. Perhaps your path is wrong? Or your require not correct? Perhaps you run something what is not startet on with the SSH command?
stackoverflow.com/questions/7092107/… everytime its the same. Install nodejs and test it again.
|
2

Because I was using RVM, I had to source that instead of Ruby directly. Not sure why, but it's working now.

My post-merge looks something like this:

#!/bin/bash

unset GIT_DIR

/usr/local/rvm/bin/rvm use 1.9.3

/usr/local/rvm/gems/ruby-1.9.3-p194/bin/jekyll

echo "Deployed!"

Not perfect – rvm echoes a load of stuff which I don't want, but it works.

Comments

0

I fixed this issue by adding the following to my ~/.bash_profile file:

source ~/.bashrc

The rvm installer should already have added

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

I added the source line above this and it fixed these issues.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.