Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git push, stream message to client terminal

Tags:

git

Say I have a git server. On every push, I need to kick off a process, and I can do this via a hook.

The need is to write the process's stdout on to the git client, who did the push. This is much similar to Heroku or Openshift push.

Question is - How do I send text streams/message back to a git client, so that it would print it on the terminal?

like image 849
Srikanth Venugopalan Avatar asked Dec 02 '25 07:12

Srikanth Venugopalan


2 Answers

The Git Hook page does mention:

Both standard output and standard error output are forwarded to git send-pack on the other end, so you can simply echo messages for the user.

Don't forget to add a set -x if you want to see all the commands executed by your script.

like image 117
VonC Avatar answered Dec 04 '25 00:12

VonC


Although @VonC's answer was perfect for me, I also came across a library that helps in this case.

Gitreceived is a part of the Flynn project:

An SSH server made specifically for accepting git pushes that will trigger an auth script and then a receiver script to handle the push.

like image 39
Srikanth Venugopalan Avatar answered Dec 03 '25 23:12

Srikanth Venugopalan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!