Git server hook streaming output

Hi everyone,

We currently use a server-side hook script to process all code pushed to our GitLab instance (Omnibus GitLab on Red Hat Linux). This hook takes some time and we’d like to print some progress messages. However, I notice that GitLab only seems to buffer messages and print them out after the hook completes.

For example, for the following hook script


echo "Message 1"
sleep 10
echo "Message 2"

We observe that “Message 1” is only printed on the Git client together with “Message 2” after the hook completes. We tried some other solutions (e.g., nginx - Git post-receive hook live output stream - Stack Overflow) but haven’t resolved the issue.

Is there a way to disable the buffer so we can have a streaming output to the Git client? Thanks!