"You are on a branch yet to be born" when adding git submodule

matt b picture matt b · Aug 9, 2012 · Viewed 33.9k times · Source

I am attempting to add a few submodules to my .vim/bundles directory, and when I attempt to add this particular repo Git gives me a strange error I've never seen before:

$ git submodule add -f git://github.com/derekwyatt/vim-scala.git .vim/bundle/vim-scala
fatal: You are on a branch yet to be born
Unable to checkout submodule '.vim/bundle/vim-scala'

Any idea what can cause this?

If I clone the same repo to a test directory (not through the submodule command), it works fine, and creates the expected files.

Answer

lisachenko picture lisachenko · Aug 22, 2012

To fix that error, you should delete the folder with the same path to the submodule inside .git/modules/ directory. This error can occurs when url was incorrect for submodule for the first-time when submodule was added.