1

I have a bare remote repository and want to invoke a hook when a "git fetch" is performed against it.

I have tried several hooks that I thought might work (post-merge, which I know is for local repos but thought I'd try it anyways), I have also tried replacing some of the git-* binaries (such as git-upload-archive and git-upload-pack) with scripts that then invoke the binaries.

Any ideas on how I can trigger a script to run when a "git fetch" is performed against a remote repository? And yes, I am aware of the docs (http://www.manpagez.com/man/5/githooks/)

1 Answer 1

2

I believe the answer is that you can't -- the hooks are called after write operations. See http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks for better wording on the use of the server hooks.

Sign up to request clarification or add additional context in comments.

1 Comment

I was looking at this doc: git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols and in the section about SSH connections it mentions running git-upload-pack remotely. I thought if I could replace git-upload-pack that would give me what I need, however when I remove the binary I can still push and pull to and from the remote repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.