Composer installation - source throw error -prefer-source

When I run composer install --prefer-source or try to update this specific package (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 suppose I messed up something in the package repository, but I have no idea what.

  • I am cloning a new project repository
  • I try "install --prefer source linker" and still get this error.

Interestingly, the error only occurs on the docker on the MAC. On another linux pc, it works fine.

+8
git github php composer-php
source share
1 answer

It looks like you manually updated the sources in the directory of your vendor for this package.

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

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

The author writes:

"This can be fixed in two ways:

  • when bonding, add the -include-untracked flag, which will also save the newly added files.

  • when checking, add the --force flag, which will overwrite files and not interrupt. "

If all else fails, you can manually remove the provider directory to force the composer to install the package again. Change See also https://getcomposer.org/doc/03-cli.md#clear-cache , perhaps the composer cached the git repository somewhere and cannot update it.

+7
source share

All Articles