#1601·husky

Input is blocked when running git push inside Husky hooks

Author: 0-SandyCreated Aug 31, 2025Updated Mar 20, 2026

Hi,

I'm running a Husky hook (post-commit) with a Bash script that calls git push. I'm using pnpm to run my scripts. When Git asks for the SSH passphrase, the terminal input is blocked and I cannot type anything. This prevents the push from completing.

post-commit

bash
#!/usr/bin/env bash

branch_name=$(git symbolic-ref --short HEAD)
retcode=$?
non_push_suffix="_local"

if [ $retcode -ne 0 ]; then
    echo "Detached HEAD detected."
    exit 1
fi

if [[ $branch_name == *$non_push_suffix ]]; then
    echo "Branch '$branch_name' ends with '$non_push_suffix'"
else
    echo
    echo "Pushing branch '$branch_name' to origin..."
    git push origin $branch_name
    echo "Congrats! Code was pushed successfully"
fi

Problem

  • When git push asks for the SSH passphrase, the input cursor does not appear.
  • I cannot enter anything, so the command hangs.
  • This only happens when the command is run inside a Husky hook.

Expected behavior:

  • Git should allow input from the terminal when run inside the hook, just like running it manually.

Additional info:

  • Husky version: 8.0.3
  • Git version: 2.50.0.windows.1
  • Pnpm version: 10.15.0
  • Node version: 22.17.0
  • OS: Windows 11 10.0.26100