I'm using this example on publishing a website w/ git post receive hooks.
The hook pretty much clones the bare repo into a temporary directory, and after generating the site, removes that temporary git clone.
#!/bin/sh
# clone a repo, generate site etc
# done generating site, remove the TMP_GIT_CLONE
rm -rf $TMP_GIT_CLONE
When I do the push, all the other tasks fine, but doesn't remove all the files.
I get the follwing errors:
remote: rm: <TMP_GIT_CLONE>/.git/objects/pack: Directory not empty
remote: rm: <TMP_GIT_CLONE>/.git/objects: Directory not emppty
...
You get the idea
However, when I invoke the post-receive
script directly from the command line, the rm
behaves as expected.
Why?
Note: I've looked at Post-hook receive act's differently to shell, where the asker's problem had to do with being in a bare repo instead of a work-tree.