【问题标题】:How to run .exe from pre-push git hook?如何从 pre-push git hook 运行 .exe?
【发布时间】:2020-08-04 14:45:58
【问题描述】:

这是我在谷歌搜索超过 4 小时后得到的结果:

#!C:/Program\ Files/Git/bin/sh.exe echo $SHELL echo "here we go" ./PrePush/GitHook.exe

控制台告诉我:

/usr/bin/bash here we go .git/hooks/pre-push: line 4: ./PrePush/GitHook.exe: No such file or directory

我的 .exe 位于:C:\Users\myUsername\Documents\MyRepos\ProjectName\.git\hooks\PrePush\GitHook.exe 但它可能是我同事驱动器上的任何路径,所以我必须使用本地路径。

我已经尝试过bin/bash.exe,使用完整路径,使用system(./PrePush/GitHook.exe)(因为我认为它是一个perl脚本) 但他们都提出了错误。

而且似乎没有“只是”从 git 挂钩调用本地 .exe 的示例。

【问题讨论】:

    标签: git githooks


    【解决方案1】:

    Git 挂钩不会从 .git/hooks 文件夹执行。您必须指定可执行文件的正确路径。

    "$(git rev-parse --git-dir)/hooks/PrePush/GitHook.exe"
    

    【讨论】:

      猜你喜欢
      • 2015-08-19
      • 1970-01-01
      • 2016-07-15
      • 2021-12-31
      • 1970-01-01
      • 2020-08-20
      • 2016-08-30
      • 2020-04-08
      • 2018-07-20
      相关资源
      最近更新 更多