Git p4 alias on Windows

Because this information is apparently not available anywhere on the internet I’m going to write it here:

git config —global alias.p4 !‘“C:\Program Files (x86)\Git\bin\git-p4.py”’

Please note that it’s single quote, then double quote, and closes double quote, single quote

Or inside your .gitconfig this is what it should look like:

[alias]

p4 = !’C:\Program Files (x86)\Git\bin\git-p4.py’

This is with git 1.7.10.msysgit.1, on Windows 7 x64. YMMV on other configurations.

3 Replies to “Git p4 alias on Windows”

  1. I don't know how you figured this out. But thank you so much. What a bitch that has been.

  2. Thanks for the information.
    I tried the same.
    But it gave me the following issue:
    C:\PROGRA~1>git p4
    /usr/bin/env: python: No such file or directory
    fatal: While expanding alias ‘p4’: ”C:\Program Files\Git\bin\git-p4.py”: No such file or directory

    I am using git version 2.6.4.windows.1 which is a 64 bit version but installs git in C:\Program Files\Git\bin\git-p4.py.

    Could you please advise how to specify the path in gitconfig.

  3. Thanks for the information.
    I tried the same.
    But it gave me the following issue:
    C:\PROGRA~1>git p4
    /usr/bin/env: python: No such file or directory
    fatal: While expanding alias ‘p4’: ”C:\Program Files\Git\bin\git-p4.py”: No such file or directory

    I am using git version 2.6.4.windows.1 which is a 64 bit version but installs git in C:\Program Files\Git\bin\git-p4.py.

    Could you please advise how to specify the path in gitconfig.

Comments are closed.