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 ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样