Costa Michailidis
Costa Michailidis

Reputation: 8178

Getting fatal error running node.js git hook

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.

Upvotes: 1

Views: 79

Answers (1)

VonC
VonC

Reputation: 1323993

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.

Upvotes: 1

Related Questions