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 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办