Git can be configured to not prompt for passwords, instead failing with an error message. This is useful for scripts that use Git, so that the script can handle the error instead of hanging indefinitely. Two distinct environment variables are used to control this behavior.
Resolve the full path of Git using shutil.which() for better subprocess security / robustness.
Example of Git clone from Python or CMake without credential prompt–prints error instead: