composer install --prefer-source throw error

时间:2016-10-04 12:49:51

标签: 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

我假设我在捆绑存储库中弄乱了一些东西,但不知道是什么。

  1. 我克隆全新的项目存储库
  2. 我尝试“composer install --prefer source”并仍然遇到错误。
  3. 有趣的是 - 错误仅发生在MAC上的docker上。在其他使用Linux的电脑上它工作正常。

1 个答案:

答案 0 :(得分:7)

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

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

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

作者写道:

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

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

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

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

相关问题