acquia / lightning-project

A Composer-based installer for the Lightning distribution of Drupal 8. Support ended on November 2, 2021 and this project is no longer maintained.
133 stars 60 forks source link

composer create-project fails with "Failed to execute git checkout" #17

Open aangelinsf opened 8 years ago

aangelinsf commented 8 years ago

After clearing the composer cache while running: composer 1.2.1 git 2.8.4 macOS 10.12

I executed: composer create-project acquia/lightning-project:^8.1.0 rh-lightning --no-interaction

And received:

...
- Installing drupal/layout_plugin (8.1.0-alpha23)
    Loading from cache

  - Installing drupal/entity_storage_migrate (dev-8.x-1.x 792dd73)
    Cloning 792dd730f32c737acef1d7292e91e2502900ff03 from cache

  [RuntimeException]                                                                                                                              
  Failed to execute git checkout '792dd730f32c737acef1d7292e91e2502900ff03' -- && git reset --hard '792dd730f32c737acef1d7292e91e2502900ff03' --  
  fatal: Not a git repository (or any of the parent directories): .git

The following post suggests adding --prefer-dist, but that did not help, nor did --prefer-source: https://github.com/composer/composer/issues/996

Is this a bad repository?

davidgil commented 8 years ago

i have the same problem, if you run a "composer update" after the crash it continues...

sumeetpareek commented 7 years ago

I have run into the same issue as well, when trying to use lightning as the base-setup on top of which we develop contenthub.

Content hub setup is done by a few shell scripts. When we install vanilla drupal from those scripts by a command like below, everything works

composer create-project drupal-composer/drupal-project:~8.0 $1 --stability dev --no-interaction --no-install --prefer-dist --profile

When trying to install lightning though, the same error reported here shows up.

composer create-project acquia/lightning-project:^8.1.0 $1 --no-interaction
[RuntimeException]                                                                                                                              
  Failed to execute git checkout '792dd730f32c737acef1d7292e91e2502900ff03' -- && git reset --hard '792dd730f32c737acef1d7292e91e2502900ff03' --  
  fatal: Not a git repository (or any of the parent directories): .git

Will report back progress.

balsama commented 7 years ago

I see no reason why this should be happening and can't reproduce. Yet it's been reported by at least three people. My version of git (2.9.3) is a little newer than @aangelinsf (2.8.4) but that seems far-fetched.

The dependency on entity_storage_migrate comes from Multiversion < alpha11. HEAD of the 8.x-1.x branch of lightning updates that to alpha12. So a workaround would be to require HEAD for now.

To do so:

  1. clone the lightning-project repo
  2. replace "drupal/lightning": "^8.1.0" with "drupal/lightning": "8.1.x-dev"
  3. delete the .git folder
  4. run composer install
sumeetpareek commented 7 years ago

Using the --no-install option and then later doing a composer update unblocked me, which was required for our purposes anyways, since content hub specific changes had to be made to composer.json before install.

mortenson commented 7 years ago

I'm getting the same error when installing contentacms 😞

benedikt-buchert commented 7 years ago

Having the same issue with thunder and contentacms. @sumeetpareek workaround helped me. Thanks! Not sure if this an issue with composer.

webchick commented 4 years ago

For folks having this problem: are you using Acquia DevDesktop?

I had the same issue (different repo) where composer create-project ... failed with the fatal: Not a git repository (or any of the parent directories): .git error, but composer create-project --no-install and then composer update worked. (Thanks, @sumeetpareek!)

I was the only one on my team having this issue though, which made it exceptionally maddening...

Through process of elimination, if I went into my .bash_profile and commented out the line to add DevDesktop's PHP to my path:

#export PATH="/Applications/DevDesktop/php7_3_x64/bin:$PATH"

...this made the CLI PHP fall back to OS X's system PHP in /usr/bin/php ... and suddenly just plain composer create-project worked fine. :fearful:

Anyway. Just in case it helps anyone, it seems that was the issue in my case... (NO idea why.)