The default installation of msysgit (aka the official git client for Windows) is unfortunately built without python support. There are understandable reasons as to why this is, starting with “where the heck do I find the various python versions on Windows”. For me the problem was that I needed git-p4 to extract some code history out of a Perforce repository and guess what, git-p4 is written in Python. Only solution for me was that I had to find a way to make this work short of throwing Linux in a VM just to get a git import going.
It actually turned out to be fairly simple. The git-p4 that comes with the msysgit installation is a very basic placeholder that the main git executable runs via its shell. Getting the git-p4 plugin to work was a simple case of dropping the “real” git-p4.py from the Linux distribution into an appropriate location and then modifying git-p4 to run my local python with the appropriate command line. Just keep in mind that the shell used by msysgit is a unix shell so you need to make sure that the paths and parameters are in /bin/sh syntax and not in DOS batch syntax. Here’s my current hacked version of git-p4 that seems to do the job:
c:/python27/python “c:/program files (x86)/Git/libexec/git-core/git-p4.py” $1 $2 $3 $4 $5 $6 $7 $8 $9