my2c
my2c

Reputation: 975

Composer says Git not found

When installing dependencies via "composer install", I'm getting error:

Installing doctrine/lexer (dev-master bc0e1f0) Cloning bc0e1f0cc285127a38c6c8ea88bc5dba2fd53e94 [RuntimeException] Failed to clone http://github.com/doctrine/lexer.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as an internal or external command, operable program or batch file.

I'm not sure what to do... I don't need git. Thanks!

Upvotes: 34

Views: 127515

Answers (7)

Kaushal Sachan
Kaushal Sachan

Reputation: 1243

composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool

Normally when you install git it's bin directory name is github So use github instead of git

Now Command is as below

composer config repositories.data-migration-tool github https://github.com/magento/data-migration-tool

After this run below command

composer require magento/data-migration-tool:2.3.0

Upvotes: 0

Janaka Pushpakumara
Janaka Pushpakumara

Reputation: 5107

I had the same issue. So I first used

composer install --prefer-dist

But it didn't work for me.

Then I used these commands and I solved my issue.

apt-get install zip
composer install --prefer-dist

This works for me. I think this will help someone.

Upvotes: 9

my2c
my2c

Reputation: 975

Using --prefer-dist worked:

composer install --prefer-dist

to force dist part, which @ivoba mentioned; it seems default switch which uses git is --prefer-source.

Upvotes: 45

abdiel
abdiel

Reputation: 2106

I had the same problem in windows and already installed git, so I fixed it just adding

C:\Program Files (x86)\Git\bin

to my path enviroment var.

Upvotes: 6

Kjell
Kjell

Reputation: 832

On El Capitan on a fresh installation you first may also run into this problem although GIT is installed. After typing sudo git --help in the terminal you get a request to agree to the XCode licence terms. Walk through this procedure and then you are good to go. Weird stuff!

Upvotes: 3

user2718285
user2718285

Reputation: 600

You should install git first

apt-get install git

Upvotes: 34

ivoba
ivoba

Reputation: 5986

You will need git, almost always with composer.

from the requirements;

To install packages from sources instead of simple zip archives, you will need git, svn or hg depending on how the package is version-controlled.

best you get git :)

update:
you could also try to override the package definition, so that they will try to get zip instead:
As fake example:

         {
            "type": "package",
            "package": {
                "name": "doctrine/lexer",
                "version": "3.1.7",
                "dist": {
                    "url": "http://www.doctrine.net/files/doctrine.zip",
                    "type": "zip"
                }
            }

https://github.com/composer/composer/blob/master/doc/04-schema.md#repositories-root-only

I did not test this, and i predict you end up in hell ;) when you will try to rewrite the f.e. doctrine composer.json.

Upvotes: 0

Related Questions