简体   繁体   English

Windows 服务端后接收 git 挂钩挂起

[英]Windows servier-side post-receive git hook hangs

I have setup Git on an Apache Server and everything is working great.我在 Apache 服务器上设置了 Git,一切正常。 Now I want to setup a post-receive hook to kick off a Jenkins build.现在我想设置一个接收后挂钩来启动 Jenkins 构建。

I have written the script and tested it on the server and there is no problem.我已经编写了脚本并在服务器上进行了测试,没有问题。 However, when I do a git push , it gets to the "Total" line and stops:但是,当我执行git push时,它会到达“Total”行并停止:

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)

Looking on the server, I can see the that the script has attempted to start, but it is hung and using one core's worth of CPU:查看服务器,我可以看到脚本已尝试启动,但它被挂起并使用了一个内核的 CPU:

在此处输入图像描述

As the script seemed to be causing a problem, I simply tried the sample script by renaming it removing the "sample" extension, but that exhibits the same behaviour.由于脚本似乎引起了问题,我只是通过重命名删除“示例”扩展名来尝试示例脚本,但它表现出相同的行为。 So i change the script to:所以我将脚本更改为:

#!/bin/sh
exit 0

or或者

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

But still the same.但还是一样。

What's going on?这是怎么回事?

Resolved.解决。 Speaking to a IT guy over the weekend, the suggestion was that the user used to run the Apache Server maybe the cause.周末与 IT 人员交谈时,建议是用户曾经运行 Apache 服务器可能是原因。 Presently the service was run using "Local System Account".目前该服务是使用“本地系统帐户”运行的。 Once changed to an actual user, the sh.exe no longer hangs.一旦更改为实际用户,sh.exe 就不再挂起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM