我是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
我如何解决此错误?
我现在无法推送到我的存储库。
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操作,但看起来可能是必要的。