30

I'm trying to use git submodule update and it's not returning anything, nor does any of the git submodule commands, and I have checked the .gitmodules file and it is correct?

I have no idea if git can be debugged or what, and it's really annoying.

There's no errors or anything, even when using 2>&1 on the end which is really worrying.

7
  • 1
    if you write git submodule does the submodules appear? Commented Jul 10, 2012 at 19:45
  • Nope kennydude@fluffy:~/Dev/boidapp$ git submodule kennydude@fluffy:~/Dev/boidapp$ Commented Jul 10, 2012 at 19:46
  • 1
    did you add the submodules like git submodule add PATHTOGITREP? there should appear some modules. nothing with git submodule status? Commented Jul 10, 2012 at 19:50
  • Yeah I did, and the .gitmodules file is correct. Nothing with status either Commented Jul 10, 2012 at 19:51
  • ok I have no idea what could happen but this should fix it, get the urls from your .gitsubmodule and git submodule add URL each one of those Commented Jul 10, 2012 at 19:53

4 Answers 4

17

Remove any submodule entries from your .git/config. git rm --cached path/to/submodule to remove it from the tree. Make sure your working directory is clean. Now you can init the submodules:

git submodule init 

All this does is populate your config with the urls that are in the .gitmodules file. Now you can populate the submodules:

git submodule update

if your submodules have nested submodules, add the recursive option:

git submodule update --recursive

Init and update are separate for a good reason. You may want to have an alternate repository to store changes to you submodule.

Sign up to request clarification or add additional context in comments.

2 Comments

When I run git submodule update --recursive, it does absolutely nothing.
i had to delete .gitmodules then git rm --cached ./.gitmodules after doing the steps you listed then did git submodule add https://urlto.git and it cloned the submodule into my parent repo
7

It could be a late answer but in case someone needs it:

Just delete you blank submodule directory and run again

git submodule add <https/ssh git link to your submodule>

Comments

1

I faced the same problem, for me helped remove .gitmodules and commit this change. After add module again using git submodule add.

Comments

0

Hopefully this will help some googlers.

I had a similar problem where nothing would make the submodules appear. The problem was that I added the submodule with an escaped windows path .\\Asset\\MyAsset instead of Asset/MyAsset

Check that your .gitmodules doesn't have a module with this style of path

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.