1

I'm running a git hook (pre-push) and getting a fatal error.

Here's my code:

#!/usr/local/bin node var exec = require('child_process').exec process.exit(1) 

Nothing crazy, just testing things out.

And it's executable.

But when I run a push I get:

fatal: cannot exec '.git/hooks/pre-push': Permission denied 

And the process hangs.

1 Answer 1

1

Try instead:

#!/usr/local/bin/node 

Make sure the path /usr/local/bin/node does exist.

Alternative (which might be what you actually wanted to do):

#!/usr/bin/env node 

Again, make sure /usr/bin/env exists, and that /usr/bin/env node returns the expected path.

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

1 Comment

Second one worked! Thanks : ) For anyone coming here later, I'm running Ubuntu 14.04. Strange. I ran which node in the terminal thinking that's the one I should be referencing. And I read on S/O that /usr/bin/env node was kind of a hack, but I guess that's rubbish.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.