Cannot get my post-commit script to run (git)

こ雲淡風輕ζ 提交于 2019-12-13 04:33:10

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!