4
我怎麼可以在包含子模塊的郵件接收鉤子中檢出我服務器上的裸倉庫?git checkout裸收到子郵件後收到
我現在有這作爲後收到鉤:
#!/bin/bash
# http://blog.ekynoxe.com/2011/10/22/git-post-receive-for-multiple-remote-branches-and-work-trees/
# post-receive hook that checks out development branch after a push to the bare
# repo
# paths must exist
livepath="/var/www/live"
devpath="/var/www/dev"
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
#if [[ "master" == "$branch" ]]; then
# git --work-tree=$livepath checkout -f $branch
# echo 'Changes pushed live.'
#fi
if [[ "develop" == "$branch" ]]; then
git --work-tree=$devpath checkout -f $branch
echo 'Changes pushed to dev.'
fi
done
但與此子模塊不會得到初始化。
我試圖做這個測試手冊:
cd /var/www/dev
git --work-tree /var/www/dev --git/dir /git/myrepo.git submodule init
git --work-tree /var/www/dev --git/dir /git/myrepo.git submodule update
submodule update
命令失敗,出現此錯誤消息:
fatal: working tree '/var/www/dev' already exists.
Clone of 'https://github.com/yiisoft/yii.git' into submodule path 'yii' failed
這種行爲已經是(解答)這裏提出質疑:Git submodules with separate work_tree
它如果它們不在那裏重新開始,它們也會很好。
我認爲你是對的,如果一個git項目包含子模塊,它不適用於當前版本的git。我只是做了你提出的建議並創建了一個克隆,取消了git變量的設置,並從該回購庫中執行了「git pull」。儘管如此,我認爲應該可以用我之前嘗試的方式。 – kmindi