dongmei9020 2010-11-24 14:22
浏览 141
已采纳

用PHP编写git钩子

I want to use PHP writing git hooks but have some problem. I use Windows 7 LAMP packet and git bash. So, if I run the next script (pre-commit hook) through git shell:

https://gist.github.com/713716

it works fine and there is 123 on the screen. But if I use:


git commit

I have the next error:


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

So, what the problem is?

  • 写回答

1条回答 默认 最新

  • douqiao8370 2010-11-24 15:32
    关注

    I rarely work on Windows systems but it might have something to do with either making sure the pre-commit file is executable by every user (per Phil's comment), or something to do with git invoking a php command.

    Looks like this problem may exist elsewhere but not easily reproduceable.

    It's janky, but it might work if you create a new file somewhere with a php extension and invoke that file from the pre-commit hook.

    #pre-commit
    C:/WebServers/usr/local/php5/php C:/path/to/123.php
    #123.php
    <?php echo 123 ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺