The MinTTY terminal that is the new default terminal for Git simply doesn't support Windows console programs. I don't know why the decision was made to change the default terminal, but I know a few ways to work around this:
- Write a Bash alias to launch python with winpty
Bash Alias (put in your .bashrc):
alias python=winpty py.exe
Note: As of Git for Windows 2.7.1, Winpty is included out of the box. winpty can be found installed at Git\usr\bin
.
- Write a Bash alias to launch python in interactive mode if there are no arguments:
Bash Alias (put in your .bashrc):
function maybe_py() {
if [ $# -eq 0 ]; then
/c/Windows/py.exe -i
else
/c/Windows/py.exe $@
fi
}
alias python=maybe_py
- Launch python in interactive mode explicitly
Note that this may not work correctly using arrow keys to browse command history:
py -i
Or for scripts:
py script.py
What Is py.exe?
In case you are wondering why I'm referencing C:\Windows\py.exe
instead of a particular python.exe
installation, I wanted to explain a few benefits of using it (the Python Launcher for Windows:
For changing your preferred/system installation (e.g. for interactive mode), see this answer.