The question “ Use git submodule update --initin an error message ” mentions an error message that you might see if you used this in your tag post-update:
GIT_WORK_TREE=/path/to/directory git submodule update --init
This will give:
remote: You need to run this command from the toplevel of the working tree.
So it’s better to cddirectly in the target repo and execute a command from there:
export GIT_DIR=$(pwd)
cd /path/to/target/workingtree
git checkout -f master
git submodule update --init --recursive
, " / git ?:
, git GIT_WORK_TREE:
, .
" Git push : " , OP iliveinapark :
, , , - .
, :
fatal: This operation must be run in a work tree
- :
git --git-dir=<my bare repo> --work-tree=<where I export to> submodule update --init --recursive
:
fatal: working tree '<where I export to>' already exists. Clone of '<submodule repo>' into submodule path '<submodule path>' failed
, , , - ( , ):
git :
-, post-receive, :
[aaron@aaronadams]$ cat > /usr/local/share/git-core/templates/hooks/post-receive.sample
#!/bin/sh
while read oldrev newrev refname
do
:
done
unset GIT_DIR
cd `git config --get core.worktree` || exit
git checkout --force
git submodule update --init --recursive --force
[aaron@aaronadams]$ chmod +x /usr/local/share/git-core/templates/hooks/post-receive.sample
.
:
[aaron@aaronadams]$ cd /var/www/vhosts/aaronadams.ca/sites/staging.aaronadams.ca
[aaron@aaronadams]$ git init && git config --bool receive.denyCurrentBranch false && git config --path core.worktree ../ && mv .git/hooks/post-receive.sample .git/hooks/post-receive
Initialized empty Git repository in /var/www/vhosts/aaronadams.ca/sites/staging.aaronadams.ca/.git/
, , , .
[aaron@aaronadams]$ git remote set-url staging aaron@aaronadams.ca:sites/staging.aaronadams.ca
[aaron@aaronadams]$ git push staging master
remote: Submodule 'codeigniter' (git://github.com/EllisLab/CodeIgniter.git) registered for path 'codeigniter'
remote: Cloning into 'codeigniter'...
remote: Submodule path 'codeigniter': checked out 'fd24adf31255822d6aa9a5d2dce9010ad2ee4cf0'
To aaron@aaronadams.ca:sites/staging.aaronadams.ca
* [new branch] master -> master
, !
, (, , ).
; , , .
OP iliveinapark , :
, .