git说“不受版本控制"刚刚签出的文件 [英] git says "not under version control" for just-checked-out file
问题描述
我给我的Git存储区以某种方式的混乱感很明显.
I have the distinct impression my Git repo is somehow mangled.
这是我正在做的顺序:
-
git clone [远程克隆字符串]
git clone [remote's clone string]
这会创建文件"App/android/AndroidManifest.xml"
This creates, among many others, a file "App/android/AndroidManifest.xml"
git mv App/android/AndroidManifest.xml App/android/AndroidManifestTemplate.xml
git mv App/android/AndroidManifest.xml App/android/AndroidManifestTemplate.xml
这将显示错误消息严重:不在版本控制下,source = App/And ..."
This gives the error message "fatal: not under version control, source=App/And..."
最初,我认为这可能是一个gitignore的事情,但事实并非如此.我尝试了git fsck,它没有任何报告.
Initially I thought this might be a gitignore thing, but that's not it either. I tried git fsck, it doesn't report anything.
关于如何修复它的任何建议?
Any suggestions on how to repair it?
推荐答案
也许确实存在App/android/AndroidManifest.xml
,但情况不同(例如App/android/androidmanifest.xml
,这意味着App/android/AndroidManifest.xml
没有版本化(因此错误消息):
Maybe App/android/AndroidManifest.xml
does exist, but with a diferent case (like App/android/androidmanifest.xml
, which would mean that App/android/AndroidManifest.xml
isn't versioned (hence the error message):
然后用正确的大小写做git mv
就足够了.
Doing the git mv
with the right case should then be enough.
OP 解释
发生的事情是Git中有两个文件夹" What happened was that there were two folders in Git, " 这篇关于git说“不受版本控制"刚刚签出的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!App
"和"app
".
当我在Windows下签出存储库时,由于Windows不区分大小写,它实际上将两个文件夹叠加到了一个文件夹中,成为"App
".
这意味着目录结构很好,但是一半的文件(来自"app
"侧的文件)具有无效的Git路径!
App
" and "app
".
When I checked out the repo under Windows, because of the case-insensitivity of Windows, it actually overlayed the two folders into one into "App
".
Which meant, the directory structure was fine, but half of the files (the ones coming from the "app
" side) had an invalid Git path!