Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if I interrupt local git process while a remote hook is running?

Tags:

git

ssh

I have a post-receive hook set up on a remote machine which checks out a working copy of a website, installs latest dependencies, rebuilds some assets, and then restarts the HTTP daemon. So I can push code from my laptop to deploy the latest version of a site.

However, the hook can take a while to run. What will happen if I Ctrl-C the git push on my laptop after the changes have been received but before the hook finishes running? Will the hook script get interrupted remotely, too?

like image 206
natevw Avatar asked Nov 26 '25 04:11

natevw


1 Answers

What will happen if I Ctrl-C the git push on my laptop after the changes have been received but before the hook finishes running?

Nothing special. The hook's output to your end gets lost, so you can't see if it worked or not. The hook itself still runs to completion, and if you write a sensible hook, it's already logging its results somewhere, as there's no guarantee that a person is watching the result now and will know what to do if it fails.

like image 106
torek Avatar answered Nov 27 '25 20:11

torek



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!