无法执行 - Git P4克隆坏了

har*_*ant 6 git perforce git-p4

安装git之后- 我尝试克隆现有的p4分支,但它失败并显示以下信息:

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?
Run Code Online (Sandbox Code Playgroud)

Sid*_*dex 7

Gabriel Morin 的回答对我来说是最好的,但它是不完整的:

  1. gitconfig 位于 C:\Program Files\Git\mingw64\etc 中。
  2. 如果你得到python.exe 'c:\program files\Git\mingw64\libexec\git-core\git-p4': python.exe: command not found你可能想要将 Python 添加到 PATH 或完全指定路径你机器上的一个 python.exe,像这样:
[alias]
    p4 = !'C:\\Program Files\\Python27\\python.exe' 'c:\\program files\\Git\\mingw64\\libexec\\git-core\\git-p4'
Run Code Online (Sandbox Code Playgroud)
  1. 即便如此,您可能会得到类似的信息:访问仓库失败:无法连接,这要么是因为您使用交互式 p4 界面,并且您没有允许您从命令行连接到 perforce 的环境变量(查看 p4 同步为您工作)并设置:
p4 set P4PORT=<server>:1666
p4 set P4USER=<user>
p4 set P4PASSWD=<password>
p4 set P4CLIENT=<some name>

Run Code Online (Sandbox Code Playgroud)
  1. git-p4.py 不适用于 Python 3.0。您需要安装 Python 2.7.3 或最高版本。


Gab*_*rin 6

至少在 2017 年 10 月,这并没有那么复杂:

我安装了适用于 Windows 的 Python 2.7.x、适用于 Windows 2.14.2 的 Git 和 Perforce 命令行工具。我将所有三个都放在我的路径上并测试我是否能够从命令行调用python,gitp4。然后我可以将它添加到我的 gitconfig 中:

[alias]
    p4 = !python.exe 'c:\\program files\\Git\\mingw64\\libexec\\git-core\\git-p4'
Run Code Online (Sandbox Code Playgroud)

然后git p4从命令行使用工作。


Rus*_*lop 6

我在Git for Windows 2.16.1.4上看到了这个并通过替换"C:\ Program Files\Git\mingw64\libexec\git-core\git-p4"中的shebang来修复它.

我换了:

#!/usr/bin/python2
Run Code Online (Sandbox Code Playgroud)

有:

#!/usr/bin/env python
Run Code Online (Sandbox Code Playgroud)


Dou*_*der 1

我在从 github 下载 git-p4 分支之一并直接调用它(git-p4)而不是通过git p4.

也许这会对你有帮助?