Git will not init/sync/update new submodules

后端 未结 21 2068
野趣味
野趣味 2020-12-12 13:11

Here\'s part of the contents of my .gitmodules file:

[submodule \"src/static_management\"]
        path = src/static_management
        url = gi         


        
21条回答
  •  伪装坚强ぢ
    2020-12-12 13:44

    Had the same issue, when git ignored init and update commands, and does nothing.

    HOW TO FIX

    1. Your submodule folder should be committed into git repo
    2. It shouldn't be in .gitignore

    If that requirements met, it will work. Otherwise, all commands will execute without any messages and result.

    If you did all that, and it still doesn't work:

    1. Add submodule manually, e.g. git submodule add git@... path/to
    2. git submodule init
    3. git submodule update
    4. commit and push all files - .gitmodules and your module folder (note, that content of folder will not commit)
    5. drop your local git repo
    6. clone a new one
    7. ensure that .git/config doesn't have any submodules yet
    8. Now, git submodule init - and you will see a message that module registered
    9. git submodule update - will fetch module
    10. Now look at .git/config and you will find registered submodule

提交回复
热议问题