Adding Python to Git Bash in Windows environment

This is a short and simple tutorial how to make Python appear to you Git Bash.

Where is the magic?

In order to start some of the languages in Bash environment, they need to be exported to the path. Also, when bash shell starts it runs some scripts before hand like setting window size, charset and colours for the bash shell.

One of these files, that are runned beforehand is called .bashrc, which is found in user home directory. If the file does not exist, it can be created real simply. This is done by using simple command

cd ~
echo 'export PATH="$PATH:/C/Python27"' >> .bashrc

So the first line makes sure that we go to home directory. Then if the file .bashrc does not exist, we create it by appending the path. By appending we are able to make sure we do not overdrive the file content.

Most likely if the the file .bash_profile does not exist, the git bash will create it.

In order to test, did the magic work, simply type:

python -V

With this, now when you re-open the git bash, the Path will remember your export and you are able to use python.