I\'m running exactly the same script.ps1 file in a Powershell ISE (manually loading the script and pressing F5) and in a Powershell console (executing the script file).
So, the example below case have any error , this command -q 2>&1 | %{ "$_" }` will nullifying the result of errors.
A solution and use: git push -q 2>&1 | %{ "$_" }
git push -q 2>&1 | %{ "$_" }