Git 的更新后挂钩在从 TortoiseGit 推送到远程计算机时运行,但不在同一计算机上的命令行中运行
我在我们的开发服务器上有一个裸存储库,并在驱动器上的其他地方有一个克隆。我编写了一个小的更新后脚本,如下所示:
#!/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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用命令行时,只需执行以下操作:
然后服务器中的更新后将运行。
When using command line, just do this:
Then the post-update in server will run.