Add a submodule which can’t be removed from the index

The only way that message ('repo' already exists in the index) can be displayed is if ‘repo’ still exists in the index (see this chapter on submodule):

$ rm -Rf rack/
$ git submodule add git@github.com:schacon/rack.git rack
'rack' already exists in the index

You have to unstage the rack directory first. Then you can add the submodule:

$ git rm -r rack
$ git submodule add git@github.com:schacon/rack.git rack

Even if ‘rack‘ isn’t a submodule, if it exists, it would prevent the declaration of a submodule of the same name.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)