Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

composer install --prefer-source throwing error

When I run composer install --prefer-source or try to update this one particular bundle ( others work well ) I get this error:

Failed to download some-bundle from source: Failed to execute git checkout 'xx' -- && git reset --hard 'xx' --

error: The following untracked working tree files would be overwritten by checkout:
...
    [ list of all files in repo on a branch that interests me ]
...
Please move or remove them before you can switch branches.
Aborting

I'm assuming I messed up something on the bundle repository, but have no idea what.

  1. I clone brand new project repository
  2. I try "composer install --prefer source" and still get that error.

What is interesting - the error occurs only on docker on MAC. On other pc with linux it works fine.

like image 967
mmmm Avatar asked Oct 04 '16 12:10

mmmm


1 Answers

It looks like you have manually updated the sources in your vendor directory of this bundle.

If so, try to commit/push or reset them directly in the vendor directory before updating the package.

If not, it may relates to this issue: https://github.com/composer/composer/issues/2896

The author writes:

"This can be fixed in two ways:

  • when stashing, add --include-untracked flag which will stash newly added files as well.

  • when checking out, add --force flag which will overwrite files instead of aborting."

If nothing helps you can manually delete the vendor directory to force composer to newly install the package. Edit Please take also a look at https://getcomposer.org/doc/03-cli.md#clear-cache, maybe composer has cached the git repository somewhere and cannot update it.

like image 119
Nico M Avatar answered Sep 23 '22 11:09

Nico M