Question

I'm using git + pathogen to track my vim plugins. I have a git repo in my .vim folder, and all my plugins are in the bundle folder.

To add a new plugin I do:

git submodules add git://github.com/plugin.git bundle/plugin

It works out of the box for most plugins (it clones the new repo to the location specified and I'm happy with my vim).

With some repos, however, it simply does not work. By not working I mean:

  • After running git submodules add it doesn't output anything (unlike the clone information).
  • An empty folder is created in bundle/plugin
  • .gitmodules and .git/config are updated to reflect the changes (opening .gitmodules you can see the new repo, just like all the others)

I was told I should run git submodule init && git submodule update after adding a new submodule. Is it possible that forgetting to do so may have caused the issues?

Was it helpful?

Solution

Submodules need to be registered in 3 places. Ensure that these are properly set up:

  1. .gitmodules file has an entry
  2. .git/config has an entry
  3. git ls-tree sha1 of the tree where the submodule is corresponds to a commit in the submodule
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top