简体   繁体   English

Git GUI和命令行-挂钩处理错误

[英]Git gui and command line - hook handling error

I am facing the different kind of situation in using Git Hooks. 我在使用Git Hooks时遇到了另一种情况。 I have created the pre-commit file in hook directory to increment my version number on every commit. 我已经在钩子目录中创建了预提交文件,以在每次提交时增加我的版本号。 I have no problem in hook as it working fine. 我没问题,因为它工作正常。 But the problem is the starting line ie 但是问题是起跑线

#!bin/sh

If hook contains this line then GIT GUI shows an error message while committing as: 如果钩子包含此行,则在提交为时,GIT GUI显示错误消息:

C:/Program Files/Git/bin/sh.exe: git Project/.git/hooks/pre-commit: bin/sh
      "bad interpreter: No such file or directory"

and if I remove the above line then GIT Command line shows the error message as: 如果我删除了上面的行,那么GIT命令行将错误消息显示为:

error: cannot spawn .git/hooks/pre-commit: No such file or directory 

As, our Developer team using both methods for commits and its impossible for developer to check/correct the hook everytime. 这样,我们的开发人员团队会同时使用两种方法进行提交,并且开发人员无法每次都检查/更正该挂钩。 Is there any alternate solution to increment the version number in the version file? 是否有其他解决方案来增加版本文件中的版本号? or Way to resolve the issue..? 或解决问题的方法..?

You wrote #!bin/sh so I feel that you are missing the first / . 您写了#!bin/sh所以我觉得您缺少第一个/

It should be: 它应该是:

#!/bin/sh

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM