无法让我的 post-commit 脚本到 运行 (git)
Cannot get my post-commit script to run (git)
我希望我的远程 git-repo 在每次有人推送时从 master 分支中的一个文件夹创建一个 zip 文件。
我重命名了 post-commit.sample 文件并添加了以下内容:
#!/bin/bash
echo "creating zip"
/usr/local/bin/git archive --format=zip --output=~/the-folder.zip master:the-folder
echo "creating zip done"
当我从我的客户端提交时,我没有看到回声,也没有得到任何 zip 文件。 post-commit 文件具有执行权限。
我错过了什么?
对于远程存储库,您应该使用 post-recieve
挂钩。我认为 post-commit
挂钩仅在客户端上 运行 而不是在远程存储库上。
来自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.
我希望我的远程 git-repo 在每次有人推送时从 master 分支中的一个文件夹创建一个 zip 文件。
我重命名了 post-commit.sample 文件并添加了以下内容:
#!/bin/bash
echo "creating zip"
/usr/local/bin/git archive --format=zip --output=~/the-folder.zip master:the-folder
echo "creating zip done"
当我从我的客户端提交时,我没有看到回声,也没有得到任何 zip 文件。 post-commit 文件具有执行权限。
我错过了什么?
对于远程存储库,您应该使用 post-recieve
挂钩。我认为 post-commit
挂钩仅在客户端上 运行 而不是在远程存储库上。
来自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.