2016-01-23 120 views
2

我試圖得到某種自動部署的工作當前工作目錄。混帳拉忽略shell腳本

我現在的post-update掛鉤看起來如下:

#!/bin/sh 

for ref in [email protected] 
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在某種程度上忽略了當前工作目錄...我如何解決此得到什麼? 或者我錯過了不同的東西?

+0

我忘了說,如果我直接運行命令(在一個交互式shell),它的工作如預期。 –

回答