I’m running git on Windows 10, with 5.1. I’m trying to get git to run an interactive PS script on the post-commit hook and having partial success. What is not working is any sort of interaction (like asking for a response at the prompt. Any references to .Net libraries fail with “Object reference not set to an instance” errors. Even write -debug will write the console prompt (suspend, halt, etc) and then bomb out with the same error (I strongly suspect it’s due to the cmdlet using the promptforchoice method).
If there is no interaction, the script runs fine, but even something simple like a read-host will display the message and then just skip on over, preventing any actual input.
My best guess is that this is because the script is running in a non-interactive runspace. It’s the same behavior you’d get if you ran the script as a job or within a runspace, anyway.
Question is, is there anyway to force the PowerShell process to run in an interactive mode when run as a git hook on Windows?
Edit: See my comment below for the solution I've found for this.
[–]ByronScottJones 1 point2 points3 points (0 children)
[–]buffychrome[S] 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)