bash 颠覆预提交钩子错误代码 255
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16583097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
subversion pre-commit hook error code 255
提问by Tanu Gupta
I added pre-commit hook script to the repository.
我在存储库中添加了预提交钩子脚本。
It always gives below error while committing:
提交时它总是给出以下错误:
svn: Commit blocked by pre-commit hook (exit code 255) with no output.
I have already checked that my pre-commit script is having executable permission and its a bash script.
我已经检查过我的预提交脚本是否具有可执行权限及其 bash 脚本。
#!/bin/bash
is added in the beginning of the file.
添加在文件的开头。
Even if I write
即使我写
exit 0
in the beginning of the file, it is not allowing me to commit and giving the same 255 error.
在文件的开头,它不允许我提交并给出相同的 255 错误。
Now my script looks like:
现在我的脚本看起来像:
#!/bin/bash
exit 0
and I am again getting the same error while committing.
我在提交时再次遇到相同的错误。
I just want to know what is error code 255 and how can I make my pre-commit script work properly?
我只想知道什么是错误代码 255 以及如何使我的预提交脚本正常工作?
回答by Tanu Gupta
There was some format issue. The file was in DOS format. I modified the format from dos to unix and it started working. I installed tool dos2unix and ran below command:
有一些格式问题。该文件为 DOS 格式。我将格式从 dos 修改为 unix 并开始工作。我安装了工具 dos2unix 并运行以下命令:
dos2unix pre-commit
回答by vaenow
I prefer to use this command in Vimbelow:
我更喜欢在Vim下面使用这个命令:
:set ff=unix

