Another repository may be present.
This was happening to me with plugin directories in my vimfiles. Reproduce like this:
- git clone something from GitHub (in my case, a plugin, eg
vim-easymotion
) somewhere into your repository (in my case into vimfiles\bundle
)
git add .
, then git status
will show that all that's been achieved is that the folder name (in this case bundle\vim-easymotion
) has been added as a new file
git commit
, then git push origin master
(pushing changes to GitHub)
- Navigate to GitHub in a browser to examine the folder that you had cloned something into in step 1, and you will see that it shows the clone's name as an empty file
I only realised what was going on when, from my vimfiles\bundle\vim-easymotion
directory in Git Bash, I issued git config -l, and noticed a reference to Lokaltog
, the owner of the vim-easymotion
repository. So I issued git remote -v
, and sure enough, in that directory the Git alias was origin https://github.com/Lokaltog/vim-easymotion.git
, which is not my repository's remote address, but that of the plugin. Stunned at my ignorance, I navigated to the plugin directory with FreeCommander, showing hidden files and of course the plugin creator's .git
files were there.
The cure, assuming you have cloned someone else's repository into yours, as I did:
- Git Bash in the offending cloned subdirectory, issue
find . | grep /.git | xargs rm -rf
to remove all of the unwanted .git
files
git remote -v
to check that you're back to your own remote's alias
- Now temporarily move the whole of that subdirectory out of your repository
git status
will now report that a file has been deleted (in my case vim-easymotion
)
git add -A
to stage that deletion, then git commit
, and git push origin master
to remove that daft filename from your remote at GitHub
- Move the (now clean) subdirectory back into your repository, and continue as normal.