在Windows上配置git p4

时间:2018-09-28 08:29:10

标签: git perforce

我正在尝试在Windows上配置git p4。我已经安装了git bash,python和p4,并能够在cmd提示符下访问它们。却无法获得

  

git p4

命令起作用。 引发错误-

  

“致命:'p4'似乎是git命令,但我们无法   执行它。也许git-p4坏了?“

Git安装在-C:\ Git \ bin

Python At- C:\ Python37-32

我还将git-p4.py文件保留在git \ bin和\ git-core下。 另外,\ git-core foler中有一个名为git p4的文件。

以下是gitconfig的内容:C:\ Git \ mingw64 \ etc

[http]
    sslCAInfo = C:/Git/mingw64/ssl/certs/ca-bundle.crt
    sslBackend = openssl
[diff "astextplain"]
    textconv = astextplain
[filter "lfs"]
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    process = git-lfs filter-process
    required = true
[credential]
    helper = manager
[p4]
    p4 = !'C:\\Git\\bin\\git-p4.py'

这是怎么了?

1 个答案:

答案 0 :(得分:2)

我的工作中存在一些非常根本的错误。如果有人面临类似问题,请参见以下评论-

  • 有三种gitconfig文件。系统,全球和本地。您必须将上述更改添加到用户目录中的全局gitconfig文件(.gitconfig)中,而不是mingw64 \ etc(gitconfig)中。

最初,全局gitconfig文件可能不存在于用户目录中。

在git bash中运行此命令以强制其创建:git config --edit --global

有关更多信息:https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Where-system-global-and-local-Windows-Git-config-files-are-saved

然后,将其添加到.gitconfig文件。 (我在做[P4]而不是[别名]

[alias]
    p4 = !'C:\\Git\\bin\\git-p4.py'

确保您能够从git bash运行 python p4 命令。

如果您遇到python的任何问题,请参考此:Python not working in the command line of git bash