1

I am trying to configure git p4 on windows. I have installed git bash, python and p4 and am able to access them on cmd prompt. But can't get

git p4

command to work. It throws error -

"fatal: 'p4' appears to be a git command, but we were not able to execute it. Maybe git-p4 is broken?"

Git Installed At - C:\Git\bin

Python At- C:\Python37-32

I have also kept git-p4.py file under git\bin and under \git-core. Also, there is a file called git p4 inside the \git-core foler.

Here are the contents of gitconfig under : 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'

What's wrong here ?

Naxi
  • 1,504
  • 5
  • 33
  • 72
  • What command are you typing exactly? `git p4` alone would be incomplete, you have to input a subcommand for `p4` to operate, like `p4 clone` or `p4 submit`. Can we safely guess you already checked [the doc](https://git-scm.com/docs/git-p4)? – Romain Valeri Sep 28 '18 at 08:31
  • **git p4** command should atleast show me a list of available commands exactly how using **git** or **p4** does. Instead it throws an error. Ans yes, I checked the doc as well. – Naxi Sep 28 '18 at 08:33
  • I'm with you to say it's not very user-friendly as it is. – Romain Valeri Sep 28 '18 at 08:34

1 Answers1

2

There were some very fundamental mistakes in what I was doing. If anyone is facing similar issue , please see below comments -

  • There are three kinds of gitconfig files. System,global & local. You have to add the above changes to global gitconfig file (.gitconfig) in user directory and not to mingw64\etc (gitconfig) .

Initialy the global gitconfig file might not be present in user directory.

Run this command in git bash to force it's creation : git config --edit --global

For more information : https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Where-system-global-and-local-Windows-Git-config-files-are-saved

Then, add this to .gitconfig file. (I was doing [P4] instead of [alias])

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

Make sure you are able to run python & p4 command from git bash.

refer this if you face any issue with python : Python not working in the command line of git bash

Naxi
  • 1,504
  • 5
  • 33
  • 72