composer install --prefer-source throw error

mmm*_*mmm 8 php git github composer-php

当我运行composer install --prefer-source或尝试更新这个特定的捆绑(其他工作正常)我得到此错误:

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
Run Code Online (Sandbox Code Playgroud)

我假设我搞砸了捆绑存储库上的东西,但不知道是什么.

  1. 我克隆全新的项目存储库
  2. 我尝试"composer install --prefer source"并仍然得到该错误.

有趣的是 - 错误只发生在MAC上的docker上.在其他与Linux的PC上它工作正常.

Nic*_*o M 7

您似乎已手动更新此捆绑包的供应商目录中的源.

如果是这样,请在更新程序包之前尝试直接在供应商目录中提交/推送或重置它们.

如果没有,它可能与此问题有关:https://github.com/composer/composer/issues/2896

作者写道:

"这可以通过两种方式解决:

  • 当存储时,添加--include-untracked标志,它也将存储新添加的文件.

  • 在签出时,添加--force标志,它将覆盖文件而不是中止."

如果没有任何帮助,您可以手动删除供应商目录以强制composer重新安装包. 编辑请看一下https://getcomposer.org/doc/03-cli.md#clear-cache,也许composer已经在某处缓存了git存储库而无法更新它.