Reputation: 6015
After git installation - I tried to clone an existing p4 branch, but it failed with the following information:
c:\P4_GIT\DT>git p4 clone //depot/CTAT/Windows/OneP/
fatal: 'p4' appears to be a git command, but we were not
able to execute it. Maybe git-p4 is broken?
Upvotes: 12
Views: 8641
Reputation: 6570
Gabriel Morin's answer is the best for me, but it's incomplete:
[alias]
p4 = !'C:\\Program Files\\Python27\\python.exe' 'c:\\program files\\Git\\mingw64\\libexec\\git-core\\git-p4'
p4 set P4PORT=<server>:1666
p4 set P4USER=<user>
p4 set P4PASSWD=<password>
p4 set P4CLIENT=<some name>
Upvotes: 8
Reputation: 1699
I saw this on Git for Windows 2.16.1.4 and fixed it by replacing the shebang in "C:\Program Files\Git\mingw64\libexec\git-core\git-p4".
I replaced:
#!/usr/bin/python2
with:
#!/usr/bin/env python
NOTE: depending on how git was installed, this file may instead be in
C:\Users\[USERNAME]\AppData\Local\Programs\Git\mingw64\libexec\git-core
Upvotes: 21
Reputation: 802
It's not that complicated really, at least as of October 2017:
I installed Python 2.7.x for Windows, Git for Windows 2.14.2, and Perforce command line tools. I put all three on my path and tested that I was able to call python
, git
and p4
from the command line. Then I was able to add this to my gitconfig:
[alias]
p4 = !python.exe 'c:\\program files\\Git\\mingw64\\libexec\\git-core\\git-p4'
Then using git p4
from the command line worked.
Upvotes: 6
Reputation: 53320
I've had more success (on Linux admittedly) downloading one of the git-p4 branches from github and calling it directly (git-p4
) rather than through git p4
.
Maybe that would help you?
Upvotes: 1
Reputation: 3249
I've never come across git for Windows with Python support (which is needed for git p4
). But maybe I'm missing something. Every time I used git p4
on Windows, I would get
> git p4
basename: too many arguments
Try `basename --help' for more information.
fatal: git was built without support for (NO_PYTHON=YesPlease).
Which is also confirmed here.
But your error message is different so maybe you do have git with Python support. Not sure...
Upvotes: 2