Asynchronous git hook? Asynchronous git hook? git git

Asynchronous git hook?


This worked for me. & and the stdout & stderr pipe must be closed:

long-running-command >&- 2>&- & 

In order to put the command in the background, both stdout AND stderr must be closed. If either of them is left open the process won't be in the background, and the commit operation won't complete until the hook script is finished.

A lazy alternative approach is to simply redirect stdout and stderr to /dev/null:

long-running-command >/dev/null 2>&1 & 

This is a bit less clean, but perhaps easier to understand and remember, and it has the same effect.