【发布时间】:2016-04-30 07:03:30
【问题描述】:
我正在尝试让某种自动部署工作。
我当前的更新后挂钩如下所示:
#!/bin/sh
for ref in $@
do
if [ $ref = "refs/heads/master" ]
then
echo "Deploying $ref to dev-domain"
cd ~/www/dev-domain
echo "" > system/lock
if ! git pull --ff-only
then
echo "Failed to pull"
exit
fi
if ! system/migrateDatabase
then
echo "Failed to migrate"
exit
fi
rm system/lock
fi
done
但我得到的只是:
remote: Deploying refs/heads/master to dev-domain
remote: fatal: Not a git repository: '.'
remote: Failed to pull
不过,文件锁定文件将被放置在正确的位置。
所以,对我来说,git pull 似乎以某种方式忽略了当前工作目录......我该如何解决这个问题?
还是我错过了一些不同的东西?
【问题讨论】:
-
我忘了说,如果我直接运行命令(在交互式 shell 中),它会按预期工作。