Errors when trying to use post receive

I'm trying to use this plugin, so I created a test script in /var/atlassian/application-data/stash/external-hooks/ called "test".

I've tried using the example script in the documentation and one that just echos one line. The file runs ok in the terminal by itself. When I enter it into the repoistory hook form, it accepts the file as being valid and executable. But then when I do a git push up to my stash repo, it does not call the hook successfully. 

The error log looks like this:

2015-08-24 14:25:50,628 ERROR [AtlassianEvent::thread-1] conn @11T3OK8x865x272x0 MYIPADDR "POST /scm/mdl/moodle.git/git-receive-pack HTTP/1.1" c.n.s.e.hook.ExternalPreReceiveHook Error running [/var/atlassian/application-data/stash/external-hooks/test, ] in /var/atlassian/application-data/stash/shared/data/repositories/2
java.io.IOException: Broken pipe
	at java.io.FileOutputStream.writeBytes(Native Method) ~[na:1.8.0_40]
	...

 

This is actually the first time I've seen the "Broken pipe" error. Every time before this it has said "no such file or directory", like this slightly older error message:

 

2015-08-24 14:12:29,906 ERROR [AtlassianEvent::thread-1] conn @11T3OK8x852x262x0 MYIPADDR "POST /scm/mdl/moodle.git/git-receive-pack HTTP/1.1" c.n.s.e.hook.ExternalPreReceiveHook Error running [/var/atlassian/application-data/stash/external-hooks/test, ] in /var/atlassian/application-data/stash/shared/data/repositories/2
java.io.IOException: Cannot run program "/var/atlassian/application-data/stash/external-hooks/test" (in directory "/var/atlassian/application-data/stash/shared/data/repositories/2"): error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[na:1.8.0_40]
	...

 

Currently my script looks like this:

#!/usr/bin/env bash
echo "Hello Git"

 

Though I have tried different scripts, for example I've tried the example script copy and pasted in exactly, and that gave me the "no such file or directory" error.

 

Could anyone help me to get this working or point me in the right direction?

 

Thanks.

1 answer

What version of Stash are you using?

Atlassian Stash v3.11.2

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

116 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you