问题
I want my remote git-repo to create a zip file from one folder in the master branch every time someone pushes.
I renamed the post-commit.sample file and added the following:
#!/bin/bash
echo "creating zip"
/usr/local/bin/git archive --format=zip --output=~/the-folder.zip master:the-folder
echo "creating zip done"
When I commit from my client I don't see the echoes and I don't get any zip-file. The post-commit file has execution privileges.
What am I missing?
回答1:
For the remote repository you should use the post-recieve
hook. I think the post-commit
hook is only run on the clients, and not on the remote repository.
From the docs
post-receive
This hook is invoked by git-receive-pack on the remote repository, which happens when a git push is done on a local repository. It executes on the remote repository once after all the refs have been updated.
来源:https://stackoverflow.com/questions/30999354/cannot-get-my-post-commit-script-to-run-git