I'm trying to create a pre-push hook that will prevent the user from pushing to a branch other than the one they're on.
Based on the the pre-push.sample (and various threads I've read) it looks like I should be able to read which local branch I am pushing and the remote one I'm pushing to via stdin with:
while read local_ref local_sha remote_ref remote_sha do ... done However when I do this, local_ref and the other variables are empty (even when running the unedited sample hook, it never enters the loop).
Is there some configuration or other step I need to do to access the variables at stdin?
I'm using git version 2.17.1
pre-pushscript looks like and (b) how you're resting it? Thepre-pushscript does receive that information onstdin; without more context that loop looks fine.