无法让我的提交后脚本运行(git) [英] Cannot get my post-commit script to run (git)
问题描述
我希望我的远程git-repo每次有人按下时都可以从master分支的一个文件夹中创建一个zip文件.
I want my remote git-repo to create a zip file from one folder in the master branch every time someone pushes.
我重命名了post-commit.sample文件,并添加了以下内容:
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"
当我从客户提交时,我看不到回声,也没有得到任何zip文件.提交后文件具有执行特权.
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.
我想念什么?
推荐答案
对于远程存储库,应使用post-recieve
挂钩.我认为post-commit
挂钩仅在客户端上运行,而不在远程存储库上运行.
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.
从文档
接收后
此挂钩由远程存储库上的git-receive-pack调用, 在本地存储库上执行git push时会发生这种情况.它 在所有引用均已完成之后,将在远程存储库上执行 已更新.
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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!