I have the distinct impression my Git repo is somehow mangled.
Here's the sequence I'm doing:
git clone [remote's clone string]
This creates, among many others, a file "App/android/AndroidManifest.xml"
git mv App/android/AndroidManifest.xml App/android/AndroidManifestTemplate.xml
This gives the error message:
fatal: not under version control, source=App/And..."
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?
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):
Doing the git mv
with the right case should then be enough.
The OP explains in the comments:
What happened was that there were two folders in 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!
Most easiest way to solve this issue is to first we need to add the file first and then we need to rename the file
$ git add file-name
$ git mv current-file-name new-file-name
and then your problem will be solve.
Another quirk that left me frustrated is if you're using the command line, it will use your current path to git mv
the file. So if you have a file in C:\Git\MyRepo\MyFolder\MyFile.txt
If you do:
c:
cd git
cd myrepo
cd myfolder
dir
It will work fine, you'll see your file. But if you type git mv MyFile.txt MyFile2.txt
you will get an error because git can't find Myfile.txt.
The reason is that it's looking at your current path, which is c:\git\myrepo\myfolder\
But git is case sensitive. So you have to go back and type
c:
cd Git
cd MyRepo
cd MyFolder
If you then type git mv it will work fine.
Putting this in as an answer for people like me that found this post while debugging this error message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With