This issue was caused when a new uncommitted java class was renamed to change capitalization on windows. I suspect it MAY have something to do with the fact windows is not case sensitive on files, but perhaps github is.
Story:
Today I created a class named [entity] which I realized I accidently didn't capitalize the first letter. Android Studio prompted me to add it to git and I said yes. Later I renamed the class correctly as [Entity], and eventually tried to commit the change.
Android Studio and Git reported the following error:
Error:error: pathspec 'core/src/com/twojeremys/merge/entity/Entity.java' did not match any file(s) known to git.
error: pathspec 'core/src/com/twojeremys/merge/entity/Projectile.java' did not match any file(s) known to git.
To fix this issue, I had to reset to head with the steps below:
- Backup the files first:
- Right-click one of the files and chose "Show in Explorer".
- Make copies of any files that have changed or the entire project to be safe.
- In Android Studio
- Delete all conflicting/erroring objects.
- VCS -> Git -> Reset Head
- WARNING: This will reset everything to the last time you did a commit to head.
- Once this is complete, just to be sure:
- Close the project, close Android studio, then reopened both.
- Create new classes to replace the deleted conflicting objects with the correct name.
- Replace the contents of these files, or copy/paste the backup files into the folder.
- Commit and push your changes now, and it should work.
If that doesn't work, good luck, I wasted 24 minutes on this ridiculous issue.
The same issue I've got every time when add file to git and rename it later. The simplest way to fix this i found was commit from the command line. I just use this way:
ReplyDeletegit status //to check what is going on
git add -A //will let you also record the removals
git commit -m 'commit name' //just do the job
Thank you for the work around. I wish Android Studio just handled this better :)
Delete