git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: error: cannot run hooks/pre-receive: No such file or directory

From
Jeff King <peff@peff.net>
Date
Mar 30, 2011, 20:04 UTC
Message-ID
<20110330200442.GA30663@sigill.intra.peff.net>
In-Reply-To
<AANLkTinehsLJWYona7ONqquWpCZozr3hW-JNMhYz4Rvn@mail.gmail.com>
On Wed, Mar 30, 2011 at 03:27:14PM +0200, Mathieu Malaterre wrote:
Show 11 quoted lines
> $ git push
> Counting objects: 5, done.
> Delta compression using up to 4 threads.
> Compressing objects: 100% (3/3), done.
> Writing objects: 100% (3/3), 304 bytes, done.
> Total 3 (delta 2), reused 0 (delta 0)
> error: cannot run hooks/pre-receive: No such file or directory
> To ssh://malat@gdcm.git.sourceforge.net/gitroot/gdcm/gdcm.old
>  ! [remote rejected] master -> master (pre-receive hook declined)
> error: failed to push some refs to
> 'ssh://malat@gdcm.git.sourceforge.net/gitroot/gdcm/gdcm.old'

We won't try to execute a hook that doesn't exist, so the "no such file or directory" almost certainly means the #! interpreter is missing.

Show 6 quoted lines
> I tried with something as simple as :
> 
> % cat pre-receive
> #!/usr/bin/ruby
> % which ruby
> /usr/bin/ruby

This might be a stupid question, but which machine is that output from? The pre-receive hook runs on the server, so you must have ruby there. I ask mainly because I didn't realize sourceforge would give people arbitrary shell access on the git boxes.

My next guess would be that the git process runs in some kind of chroot that doesn't have ruby in it.

> Do I need to do something special with ruby ?
>From git's perspective, no, but it may depend on how the server is
configured.
-Peff
Previous: Computer DruidNext: Mathieu Malaterre
Message 3 of 4 in “error: cannot run hooks/pre-receive: No such file or directory”
  1. Mathieu MalaterreMar 30, 2011
  2. Computer DruidMar 30, 2011
  3. Jeff KingMar 30, 2011
  4. Mathieu MalaterreMar 31, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.