【问题标题】:Windows servier-side post-receive git hook hangsWindows 服务器端接收后 git 挂钩挂起
【发布时间】:2020-06-05 01:53:31
【问题描述】:

我在 Apache 服务器上设置了 Git,一切正常。现在我想设置一个接收后挂钩来启动 Jenkins 构建。

我已经编写了脚本并在服务器上测试了它,没有问题。但是,当我执行git push 时,它会到达“总计”行并停止:

C:\develop\.ws\git-repo>git push
Username for 'https://internal.git.repo.com': user
Password for 'https://user@internal.git.repo.com':
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 12 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 289 bytes | 289.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)

查看服务器,我可以看到脚本已尝试启动,但它被挂起并使用了一个内核的 CPU:

由于脚本似乎引起了问题,我只是通过重命名删除“示例”扩展名来尝试示例脚本,但它表现出相同的行为。所以我将脚本更改为:

#!/bin/sh
exit 0

#!C:/git-2.25.1/bin/sh.exe
exit 0

但还是一样。

发生了什么事?

【问题讨论】:

    标签: git apache githooks


    【解决方案1】:

    已解决。周末与 IT 人员交谈时,建议是用户曾经运行 Apache 服务器可能是原因。目前该服务是使用“本地系统帐户”运行的。更改为实际用户后,sh.exe 不再挂起。

    【讨论】:

      猜你喜欢
      • 2011-12-28
      • 1970-01-01
      • 2019-06-10
      • 2020-02-11
      • 2018-11-03
      • 2015-03-15
      • 1970-01-01
      • 1970-01-01
      • 2017-05-03
      相关资源
      最近更新 更多