更新
我弄清楚了为什么只有 Windows 用户会遇到问题:
$ git ls-files | grep -i class.bat
etc/apps/phpsysinfo/plugins/BAT/class.BAT.inc.php
etc/apps/phpsysinfo/plugins/bat/class.bat.inc.php
在 Git 索引文件中,大写和小写版本都存在。Linux 用户必须将这两个文件都签出,甚至没有注意到,因为 Linux 区分大小写并将它们视为两个单独的文件,就像它们一样。
但是,Windows 在文件路径方面不区分大小写,因此它认为它们是同一个文件,并且当它尝试将它们都从索引中检出到文件系统中时,它和/或 Git 会感到困惑。如果您在 Windows 上签出文件的两个版本,我不会感到惊讶
git config core.ignorecase false && \
git rm -r . && \
git reset --hard HEAD
旧的大写文件应该从 repo 中删除。向上游提出更改请求,我相信项目所有者将不胜感激。
旧答案
core.ignorecase
我在(Windows)Git 默认设置为 true的情况下尝试了这个:
$ git diff --name-only | xargs git rm -f
这将删除所有大写文件(并在 Git 索引中暂存这些更改),所以之后我运行git status
:
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: etc/apps/phpsysinfo/includes/mb/class.Coretemp.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.HDDTemp.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.HWSensors.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.Healthd.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.IPMI.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.K8Temp.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.LMSensors.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.MBM5.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.MBMon.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.Sensors.inc.php
# deleted: etc/apps/phpsysinfo/includes/ups/class.Apcupsd.inc.php
# deleted: etc/apps/phpsysinfo/includes/ups/class.Nut.inc.php
# deleted: etc/apps/phpsysinfo/plugins/BAT/class.BAT.inc.php
# deleted: etc/apps/phpsysinfo/plugins/BAT/js/BAT.js
# deleted: etc/apps/phpsysinfo/plugins/BAT/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/BAT/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/BAT/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/MDStatus/class.MDStatus.inc.php
# deleted: etc/apps/phpsysinfo/plugins/MDStatus/css/MDStatus.css
# deleted: etc/apps/phpsysinfo/plugins/MDStatus/js/MDStatus.js
# deleted: etc/apps/phpsysinfo/plugins/MDStatus/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/MDStatus/lang/de.xml
# deleted: etc/apps/phpsysinfo/plugins/MDStatus/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/MDStatus/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/PS/class.PS.inc.php
# deleted: etc/apps/phpsysinfo/plugins/PS/js/PS.js
# deleted: etc/apps/phpsysinfo/plugins/PS/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/PS/lang/de.xml
# deleted: etc/apps/phpsysinfo/plugins/PS/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/PS/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/PSStatus/class.PSStatus.inc.php
# deleted: etc/apps/phpsysinfo/plugins/PSStatus/css/PSStatus.css
# deleted: etc/apps/phpsysinfo/plugins/PSStatus/js/PSStatus.js
# deleted: etc/apps/phpsysinfo/plugins/PSStatus/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/PSStatus/lang/de.xml
# deleted: etc/apps/phpsysinfo/plugins/PSStatus/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/PSStatus/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/Quotas/class.Quotas.inc.php
# deleted: etc/apps/phpsysinfo/plugins/Quotas/css/Quotas.css
# deleted: etc/apps/phpsysinfo/plugins/Quotas/js/Quotas.js
# deleted: etc/apps/phpsysinfo/plugins/Quotas/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/Quotas/lang/de.xml
# deleted: etc/apps/phpsysinfo/plugins/Quotas/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/Quotas/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/SMART/class.SMART.inc.php
# deleted: etc/apps/phpsysinfo/plugins/SMART/css/SMART.css
# deleted: etc/apps/phpsysinfo/plugins/SMART/js/SMART.js
# deleted: etc/apps/phpsysinfo/plugins/SMART/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/SMART/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/SMART/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/SNMPPInfo/class.SNMPPInfo.inc.php
# deleted: etc/apps/phpsysinfo/plugins/SNMPPInfo/js/SNMPPInfo.js
# deleted: etc/apps/phpsysinfo/plugins/SNMPPInfo/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/SNMPPInfo/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/SNMPPInfo/lang/pl.xml
# deleted: etc/apps/phpsysinfo/plugins/UpdateNotifier/class.UpdateNotifier.inc.php
# deleted: etc/apps/phpsysinfo/plugins/UpdateNotifier/js/UpdateNotifier.js
# deleted: etc/apps/phpsysinfo/plugins/UpdateNotifier/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/UpdateNotifier/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/UpdateNotifier/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/UpdateNotifier/lang/pl.xml
#
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: etc/apps/phpsysinfo/includes/mb/class.coretemp.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.hddtemp.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.healthd.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.hwsensors.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.ipmi.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.k8temp.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.lmsensors.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.mbm5.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.mbmon.inc.php
# deleted: etc/apps/phpsysinfo/includes/mb/class.sensors.inc.php
# deleted: etc/apps/phpsysinfo/includes/ups/class.apcupsd.inc.php
# deleted: etc/apps/phpsysinfo/includes/ups/class.nut.inc.php
# deleted: etc/apps/phpsysinfo/plugins/bat/class.bat.inc.php
# deleted: etc/apps/phpsysinfo/plugins/bat/js/bat.js
# deleted: etc/apps/phpsysinfo/plugins/bat/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/bat/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/bat/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/mdstatus/class.mdstatus.inc.php
# deleted: etc/apps/phpsysinfo/plugins/mdstatus/css/mdstatus.css
# deleted: etc/apps/phpsysinfo/plugins/mdstatus/js/mdstatus.js
# deleted: etc/apps/phpsysinfo/plugins/mdstatus/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/mdstatus/lang/de.xml
# deleted: etc/apps/phpsysinfo/plugins/mdstatus/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/mdstatus/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/ps/class.ps.inc.php
# deleted: etc/apps/phpsysinfo/plugins/ps/js/ps.js
# deleted: etc/apps/phpsysinfo/plugins/ps/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/ps/lang/de.xml
# deleted: etc/apps/phpsysinfo/plugins/ps/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/ps/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/psstatus/class.psstatus.inc.php
# deleted: etc/apps/phpsysinfo/plugins/psstatus/css/psstatus.css
# deleted: etc/apps/phpsysinfo/plugins/psstatus/js/psstatus.js
# deleted: etc/apps/phpsysinfo/plugins/psstatus/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/psstatus/lang/de.xml
# deleted: etc/apps/phpsysinfo/plugins/psstatus/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/psstatus/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/quotas/class.quotas.inc.php
# deleted: etc/apps/phpsysinfo/plugins/quotas/css/quotas.css
# deleted: etc/apps/phpsysinfo/plugins/quotas/js/quotas.js
# deleted: etc/apps/phpsysinfo/plugins/quotas/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/quotas/lang/de.xml
# deleted: etc/apps/phpsysinfo/plugins/quotas/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/quotas/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/smart/class.smart.inc.php
# deleted: etc/apps/phpsysinfo/plugins/smart/css/smart.css
# deleted: etc/apps/phpsysinfo/plugins/smart/js/smart.js
# deleted: etc/apps/phpsysinfo/plugins/smart/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/smart/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/smart/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/snmppinfo/class.snmppinfo.inc.php
# deleted: etc/apps/phpsysinfo/plugins/snmppinfo/js/snmppinfo.js
# deleted: etc/apps/phpsysinfo/plugins/snmppinfo/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/snmppinfo/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/snmppinfo/lang/pl.xml
# deleted: etc/apps/phpsysinfo/plugins/updatenotifier/class.updatenotifier.inc.php
# deleted: etc/apps/phpsysinfo/plugins/updatenotifier/js/updatenotifier.js
# deleted: etc/apps/phpsysinfo/plugins/updatenotifier/lang/cz.xml
# deleted: etc/apps/phpsysinfo/plugins/updatenotifier/lang/en.xml
# deleted: etc/apps/phpsysinfo/plugins/updatenotifier/lang/fr.xml
# deleted: etc/apps/phpsysinfo/plugins/updatenotifier/lang/pl.xml
#
如您所见,大写文件已暂存以进行提交,但现在我们可以看到还有同名的小写文件,但它们尚未暂存。
然后我提交了大写文件的删除:
$ git commit -m "Delete upper-case files"
然后我做了硬重置:
$ git reset --hard head
然后我做了状态,它没有显示任何变化:
$ git status
# On branch master
nothing to commit, working directory clean
然后,如果我find
为其中一个小写文件执行 a :
$ find . -name class.bat.inc.php
./etc/apps/phpsysinfo/plugins/BAT/class.bat.inc.php
它仍在工作目录中。不确定这是否是解决问题的正确方法。我仍然不确定问题的本质是什么。显然它与 Windows 中的文件不区分大小写有关,但为什么 Windows 用户有问题而 Unix 用户没有,我不确定。
附带说明一下,既然phpsysinfo 项目位于 GitHub 而不是 SVN repo上,zpanelx 作者可能有兴趣将其设为submodule。也许这将有助于避免将来出现此类问题?
实际上,也许这就是您可以为项目所有者做的事情?只需从您的存储库中删除整个./etc/apps/phpsysinfo
文件,提交,然后将其作为子模块再次添加。推送到您的原点,然后发出拉取请求,瞧!