Git 的更新后挂钩在从 TortoiseGit 推送到远程计算机时运行,但不在同一计算机上的命令行中运行

发布于 2024-08-18 06:28:39 字数 1548 浏览 5 评论 0原文

我在我们的开发服务器上有一个裸存储库,并在驱动器上的其他地方有一个克隆。我编写了一个小的更新后脚本,如下所示:

#!/bin/sh
echo Updating vhosts.git at `date` >> /root/vhosts.log
cd /usr/local/www
echo Updating `pwd` vhosts as `whoami`
OLD_GIT_DIR=$GIT_DIR
GIT_DIR=.git
git pull origin master
GIT_DIR=$OLD_GIT_DIR
apachectl restart

当使用 TortoiseGit 从我的计算机推送到裸存储库时,我得到了预期的输出:

git.exe push    "origin" master:master

Counting objects: 5, done.
Compressing objects: 100% (3/3)
Writing objects: 100% (3/3)
Writing objects: 100% (3/3), 346 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
Updating /usr/local/www vhosts as root
From /root/vhosts
 * branch            master     -> FETCH_HEAD
Updating 0a48898..c334796
Fast forward
 vhosts.conf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
[Thu Jan 21 10:49:39 2010] [warn] module dav_module is already loaded, skipping
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
To root@bugs:vhosts.git
   0a48898..c334796  master -> master

但是,如果我使用 命令行git 使用相同的命令将相同的克隆推送到相同的开发服务器,甚至,看起来挂钩没有运行!

C:\www\bugs_vhosts>git.exe push    "origin" master:master
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 320 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To root@bugs:vhosts.git
   c334796..9bedd46  master -> master

有谁知道我是否需要更改设置或其他内容才能触发更新后挂钩?

I've got a bare repository on our development server here, and a clone of that elsewhere on the drive. I've written a small post-update script as follows:

#!/bin/sh
echo Updating vhosts.git at `date` >> /root/vhosts.log
cd /usr/local/www
echo Updating `pwd` vhosts as `whoami`
OLD_GIT_DIR=$GIT_DIR
GIT_DIR=.git
git pull origin master
GIT_DIR=$OLD_GIT_DIR
apachectl restart

When pushing to the bare repo from my computer using TortoiseGit, I get the expected output:

git.exe push    "origin" master:master

Counting objects: 5, done.
Compressing objects: 100% (3/3)
Writing objects: 100% (3/3)
Writing objects: 100% (3/3), 346 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
Updating /usr/local/www vhosts as root
From /root/vhosts
 * branch            master     -> FETCH_HEAD
Updating 0a48898..c334796
Fast forward
 vhosts.conf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
[Thu Jan 21 10:49:39 2010] [warn] module dav_module is already loaded, skipping
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
To root@bugs:vhosts.git
   0a48898..c334796  master -> master

However, if I use the command-line git to push the same clone to the same dev server, with the same command, even, it appears the hook does not run!

C:\www\bugs_vhosts>git.exe push    "origin" master:master
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 320 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To root@bugs:vhosts.git
   c334796..9bedd46  master -> master

Does anyone know if there's a setting or something else I need to change to trigger the post-update hook?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒绊 2024-08-25 06:28:39

使用命令行时,只需执行以下操作:

git.exe push origin master

然后服务器中的更新后将运行。

When using command line, just do this:

git.exe push origin master

Then the post-update in server will run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文