Joseph Woodward
Joseph Woodward

Reputation: 9281

Not a git repository error when updating via Composer

I'm trying to update my Symfony 2 project from 2.1.4 to 2.1.7 using composer and run php composer.phar update as normal, after updating a few dependencies I receive the following error:

[RuntimeException]
Failed to clone http://github.com/fabpot/Twig-extensions via git, https
and http protocols, aborting.

- git://github.com/fabpot/Twig-extensions
  fatal: Not a git repository (or any of the parent directories): .git

- https://github.com/fabpot/Twig-extensions
  fatal: Not a git repository (or any of the parent directories): .git

- http://github.com/fabpot/Twig-extensions
  fatal: Not a git repository (or any of the parent directories): .git

I've checked the URL and can confirm that it exists, I'm also able to git clone it without any issues from the same CLI.

What's odd is if I run php composer.phar update twig/extensions separately it seems to update without a problem.

Upvotes: 3

Views: 4377

Answers (2)

mperrin
mperrin

Reputation: 994

Note that currently, I experience a similar issue while using composer with hhvm and PHP 7.

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

The error appears depending on the composer.json not always but rather regularly. I switch off hhvm to get it working.

Upvotes: 0

Seldaek
Seldaek

Reputation: 42026

This typically happens if you have an old symfony copy that shipped with the vendors installed as git repos but with the git repos removed. To fix it you should just remove the vendor directory so they will reinstall from scratch as git clones or as zip archives, but without any previous assumptions.

Upvotes: 17

Related Questions