I want to have a sub
repo inside my main
repo which can push and pull from a completely different remote repo than my main
. So I want a submodule. But I want to create the submodule locally, then push it to remote. It does not exist anywhere yet.
All the of the examples I have seen involve pulling a remote repo into a submodule, to the degree that this is how submodules are created to begin with
git submodule add [email protected]:url_to/awesome_submodule.git path_to_awesome_submodule
Is there any way to create the submodule, make some commits, then push them to the remote repo in question?
No: your submodule must have a remote repo from which it is cloned.
In your case, make sure the root folder of your sub-repo is not tracked:
Then move/delete it, and add it back as a submodule repo:
From there, you can go in that submodule and: