I'm hitting this git error with sub module creation. I initial had a bad URL in the command, now any additional runs show this error. Any ideas on what is wrong?
$ git submodule add -f https://github.com/Shougo/vimproc.vim.git .vim/bundle/vimproc
Adding existing repo at '.vim/bundle/vimproc' to the index
fatal: Not a git repository: .vim/bundle/vimproc/../../../.git/modules/.vim/bundle/vimproc
Failed to add submodule '.vim/bundle/vimproc'
You can fix it by: either committing or undoing the changes/evolutions within each of your submodules, before going back to the parent repo (where the diff shouldn't report "dirty" files anymore). To undo all changes to your submodule just cd into the root directory of your submodule and do git checkout .
Use the git submodule update command to set the submodules to the commit specified by the main repository. This means that if you pull in new changes into the submodules, you need to create a new commit in your main repository in order to track the updates of the nested submodules.
If you want to make a change within a submodule, you should first check out a branch, make your changes, publish the change within the submodule, and then update the superproject to reference the new commit.
Maybe the submodules were added to the index. You should remove them from the index.
To remove a submodule completely, perform following steps:
1 remove these lines from .git/config
[submodule ".vim/bundle/vimproc"]
url = https://github.com/Shougo/vimproc.vim.git
2 remove these lines from .gitmodules
[submodule ".vim/bundle/vimproc"]
path = .vim/bundle/vimproc
url = https://github.com/Shougo/vimproc.vim.git
3 remove the submodule directory
rm -rf .vim/bundle/vimproc
4 unstage submodule
git rm --cached .vim/bundle/vimproc
5 remove submodule directory in .git/modules
rm -rf .git/modules/.vim/bundle/vimproc
Finally, add the submodule again.
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