phpro / grumphp

A PHP code-quality tool
MIT License
4.14k stars 429 forks source link

Getting 'git' is not recognized as an internal or external command Even git is installed correctly #759

Closed doroness closed 4 years ago

doroness commented 4 years ago

Trying to run grumphp. Git is installed and set correctly on PATH. (I can even run git on vendor/bin) But I keep getting this error

In Repository.php line 558:

Error while running git command:
git --git-dir "D:\local sites\ground-zero\app\public\wp-content\plu
gins\WordPress-Widget-Boilerplate.git" --work-tree "D:/local sites
/ground-zero/app/public/wp-content/plugins/WordPress-Widget-Boilerp
late" ls-files "D:\local sites\ground-zero\app\public\wp-content\pl
ugins\WordPress-Widget-Boilerplate\vendor\bin"

'git' is not recognized as an internal or external command,
operable program or batch file.

grumphp.yml is on project root folder (...\app\public\wp-content\plugins\WordPress-Widget-Boilerplate\grumphp.yml)

Q A
Version `^0.16.2'
Bug? yes
New feature? no
Question? yes
Related tickets git

My configuration

# grumphp.yml
parameters:
    git_dir: .git
    bin_dir: vendor/bin
    process_timeout: 120
    tasks:
      securitychecker:
      composer:
      jsonlint:
      xmllint:
      yamllint:
      phplint:
        exclude:
          - vendor/
      phpcs:
        metadata:
          priority: 200
      phpcsfixer2:
        allow_risky: true
        config: '.php_cs.dist'
        metadata:
          priority: 300
      phpparser:
        visitors:
          forbidden_function_calls:
            blacklist:
              - "exit"
              - "var_dump"
      phpversion:
        project: '7.1'
      phpmd:
        exclude: ['vendor']
        ruleset: ['phpmd.xml']

**Steps to reproduce:**
Get composer file from here
Add to project root directory
run composer install

# Your actions
# Please add the steps on how to reproduce the issue here.

# Run GrumPHP:

./vendor/bin/grumphp run

Result:

# Please add the result of the run or git commit actions here.

In Repository.php line 558:

Error while running git command:
git --git-dir "D:\local sites\ground-zero\app\public\wp-content\plu
gins\WordPress-Widget-Boilerplate.git" --work-tree "D:/local sites
/ground-zero/app/public/wp-content/plugins/WordPress-Widget-Boilerp
late" ls-files "D:\local sites\ground-zero\app\public\wp-content\pl
ugins\WordPress-Widget-Boilerplate\vendor\bin"

'git' is not recognized as an internal or external command,
operable program or batch file.

Judapriest commented 4 years ago

Try replacing git_dir: .git by git_dir: .

It's looking the for git folder path

veewee commented 4 years ago

Hello @doroness,

This error is triggered inside the "gitonomy/gitlib" package. We do not locate the git command ourselves inside this package.

It looks like it cannot be resolved, even though it is installed. You might want to add the correct path to $PATH?