Search code examples
githerokugithubgit-submodules

How to add sub-modules to github repository


Hello i am looking for a way to add my submodules to my github repo for example

iris

https://github.com/kataras/iris

I tried

git add *
git add .

and then committing and pushing but the folder stay empty (greyed out)

The reason I want to add these submodules is because I want to deploy my application on heroku.

But since the submodules do not get uploaded into my github repo I can not deploy my heroku application since it is missing them from my github repository.

Any ideas on how to add these submodules to my repo would be much appreciated.


Solution

  • If you add a nested git repo, you will get a gray folder (gitlink) without being able to retrieve its content.

    You need to:

    • make sure there is no pending changes in that nested git repo (everything is committed and pushed to the nested repo remote url)
    • git rm --cached nested_repo_root_folder (no trailing slash)
    • delete completely the nested repo root folder and its content

    Then, you can add back that nested repo as a full-fledged submodule:

    git submodule add -- /url/nested/repo