jlconlin
jlconlin

Reputation: 15084

Why is git submodule path wrong?

I have a git repository (which I'll refer to as ml) located at

ssh://ml-fey/usr/projects/data/nuclear/mc/type1

This repository has a submodule. The .gitmodules file looks like this

[submodule "Appendix"]
    path = Appendix
    url = /usr/projects/data/nuclear/mc/type1/Appendix

I can clone the repository to a new repository (which I'll refer to as XL), however when I try to update the submodule I get this error

$ git submodule update
Cloning into 'Appendix'...
fatal: '/usr/projects/data/nuclear/mc/Appendix' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Clone of 'ssh://ml-fey/usr/projects/data/nuclear/mc/Appendix' into submodule path 'Appendix' failed

Notice that the directory from which it is search for the Appendix submodule is missing the final type1 directory. The reason git can't update the submodule in XL is because ssh://ml-fey/usr/projects/data/nuclear/mc/Appendix doesn't exist. Where did the type1 go?

The .gitmodules file for the XL repository looks like:

[submodule "Appendix"]
    path = Appendix
    url = /usr/projects/data/nuclear/mc/type1/Appendix

Upvotes: 4

Views: 8040

Answers (2)

I don't have enough reputation yet, so I put it as new answer. Execute command git submodule sync inside the submodule directory, not parent git root directory.

Upvotes: 0

Gary Fixler
Gary Fixler

Reputation: 6048

Submodules are also called out in your .git/config file. Is the URL correct in there? If not, you can use git submodule sync to sync things up.

Upvotes: 18

Related Questions