清除缓存时构建树时出现Git错误

问题描述 投票:0回答:1

我是Git的新手。我以前所有的工作。但是问题出在我尝试遵循一些有关.gitignore不能正常工作的教程时。最后,我使用了git clearcache,但是现在出现了其他错误

我用过:


git add .

git commit -m "testing gitignore"

git push origin arabic

错误:

You have both vendor/kartik-v/bootstrap-fileinput and vendor/kartik-v/bootstrap-fileinput/.github/CODE_OF_CONDUCT.md
You have both vendor/kartik-v/dependent-dropdown and vendor/kartik-v/dependent-dropdown/.github/CONTRIBUTING.md
You have both vendor/kartik-v/strength-meter and vendor/kartik-v/strength-meter/.github/CONTRIBUTING.md
You have both vendor/kartik-v/yii2-krajee-base and vendor/kartik-v/yii2-krajee-base/.github/CONTRIBUTING.md
You have both vendor/kartik-v/yii2-password and vendor/kartik-v/yii2-password/.github/CONTRIBUTING.md
You have both vendor/kartik-v/yii2-widget-datepicker and vendor/kartik-v/yii2-widget-datepicker/.github/CONTRIBUTING.md
You have both vendor/kartik-v/yii2-widget-depdrop and vendor/kartik-v/yii2-widget-depdrop/.github/CONTRIBUTING.md
You have both vendor/kartik-v/yii2-widget-fileinput and vendor/kartik-v/yii2-widget-fileinput/.github/CONTRIBUTING.md
You have both vendor/kartik-v/yii2-widget-select2 and vendor/kartik-v/yii2-widget-select2/.github/CODE_OF_CONDUCT.md
You have both vendor/kartik-v/yii2-widget-typeahead and vendor/kartik-v/yii2-widget-typeahead/.github/CONTRIBUTING.md
...
error: Error building trees

我如何解决此错误?

我现在无法推送到我的存储库。

php git yii2
1个回答
0
投票

git clearcache不是Git命令。 (您从哪里得到的?)

错误消息表明,无论此git clearcache程序是什么,都损坏了Git的索引。如果您不介意失去git add .的效果,则可以使用以下基本shell命令重新构建索引,然后重新执行git add

rm .git/index
git reset
git add .

((假设您位于存储库的顶层,因此.git/index命名Git的索引文件)。删除文件并运行git reset会从当前提交中重建索引,从而破坏了之前所有git add和/或git rm命令的效果。

如果git clearcache包含这样的命令,这也会撤消its操作,但看起来可能是必要的。

© www.soinside.com 2019 - 2024. All rights reserved.