Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

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

Open
aangelinsf opened this issue Oct 21, 2016 · 7 comments
Open

Comments

@aangelinsf
Copy link

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:
composer/composer#996

Is this a bad repository?

@davidgil
Copy link

davidgil commented Nov 3, 2016

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

@sumeetpareek
Copy link

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
Copy link
Contributor

balsama commented Nov 10, 2016

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
Copy link

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
Copy link

I'm getting the same error when installing contentacms 😞

@benedikt-buchert
Copy link

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

@webchick
Copy link

webchick commented Feb 21, 2020

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. 😨

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants