[英]error: cannot spawn hooks/pre-receive:No such file or directory,but hooks/pre-receive is exist in server-side git-repository
A project clone from my Gogs web server, then I add a file to the Git repository,and push this commit to remote, but the terminal report error about cannot spawn hooks/pre-receive:No such file or directory
. 从我的Gogs Web服务器克隆项目,然后将文件添加到Git存储库,并将此提交推送到远程,但是有关终端报告的错误
cannot spawn hooks/pre-receive:No such file or directory
。
I checked it and ensure the pre-receive
file is exist in server-side git-repository
, and the cloned had a file is named pre-receive.sample
. 我检查了一下并确保
server-side git-repository
存在pre-receive
文件,并且克隆的文件名为pre-receive.sample
。
So, I don't know why does this happened and what can I do for resolve it. 因此,我不知道为什么会发生这种情况以及如何解决。 Please help.
请帮忙。
server-side image: 服务器端映像:
enter image description here 在此处输入图片说明
client-side image: 客户端图片:
enter image description here 在此处输入图片说明
system env: enter image description here 系统环境: 在此处输入图片描述
pre-receive.sample
is just that — a sample. pre-receive.sample
只是一个示例。 Anyway pre-receive
is meaningless on the client side so this part can be ignored or even removed from the question. 无论如何,
pre-receive
在客户端上是没有意义的,因此可以忽略该部分甚至将其从问题中删除。
hooks/pre-receive
on the server side is more interesting. 服务器端的
hooks/pre-receive
更加有趣。 It exists and it seems the server tries to run it but failed. 它存在并且服务器似乎尝试运行它但失败了。 I suspect there is a problem with the shebang — the 1st line of the script that points to interpreter (most probably the shell) to run the script.
我怀疑shebang存在问题-脚本的第一行指向运行该脚本的解释器(很可能是shell)。 Please verify the shell exist on the server.
请验证外壳程序在服务器上是否存在。 For example if the shebang is
#!/bin/bash
verify there is /bin/bash
file at the server and the file can be run. 例如,如果shebang是
#!/bin/bash
验证服务器上是否存在/bin/bash
文件,并且该文件可以运行。 Fix the shebang — that is, point it to an existing shell like /bin/sh
. 修复shebang-将其指向
/bin/sh
shell /bin/sh
类的现有shell。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.