【问题标题】:How a git repo local directory can be extracted when a hook is executed?执行钩子时如何提取 git repo 本地目录?
【发布时间】:2015-11-19 07:30:46
【问题描述】:

基本上就像它所说的那样。想象一下下面的钩子代码:

@echo on
echo.
echo.
echo.
echo %CD%         :: Try to print the current dir
echo %GIT_DIR%    :: Try to print the Git dir
echo.
echo.
ping 127.0.0.1 -t :: Loop on localhost, because timeout will break the hook

当它运行时它不会打印任何东西,我为此设置了@echo..

任何想法。坦克!

【问题讨论】:

    标签: git githooks git-commit pre-commit-hook


    【解决方案1】:

    将在 shell 会话(不是 Windows CMD 会话)中执行预提交挂钩(即使在 Windows 上)

    试试看是否有这样的预提交脚本:

    #!/bin/sh
    echo test
    

    在你提交时确实会显示一些东西。

    【讨论】:

    • 我在 Windows 上,我修复了我的 pb 重新定位到 outout 文件中;)我在 Using Lua scrpt 上做了一个自定义
    猜你喜欢
    • 2010-12-20
    • 2018-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多