我在我们的开发服务器上有一个裸存储库,在驱动器的其他地方有一个克隆。我编写了一个小的更新后脚本,如下所示:
#!/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
有谁知道我是否需要更改设置或其他内容以触发更新后挂钩?