Url = then, just update your submodule: git submodule update -remote
Solution 1: If you are not interesting in testing/changing the content of your submodule, but you need it to make your tests, then you can include the external website link directly in the. I created bare repo in (B): mkdir /path/to/bare_git & cd /path/to/bare_gitĪnd added it as a new remote in my local repo in (A): git add remote name_of_B_repo pushed the local repo in (A) (possibly with changes not made public yet) to my ssh repo: git push name_of_B_repo branch_to_pushĪfter this, I clone my bare repo from within (B): mkdir /path/to/B_clone & cd /path/to/B_cloneĪnd I could see that my submodule was not included.
I had a similar problem: a clone of a repo in a PC (A) with remote in an external website and I wanted to have a clone of my local repo in another PC (B) in the same network where I could push my changes to (through ssh) and make some tests (some of my regression test take a very long time), so that I could keep on working on (A) on an different branch if needed.
Here a simple example step by step: Git: Pushing a new submodule Git: how to push submodule to a remote repository? I guess the step you are missing is therefore parents central repo hook checks out to your server, and updates submodule thereĪs Jefromi pointed out, your submodule needs a remote to be able to get pushed.push parent project to its central repo.add submodule in parent repo (make it aware of the new commit) and commit.push third-party library to its central repository.commit in third-party submodule (or standalone clone of it).So, to recap, the workflow is something like this: When you commit in one of the submodules, youd push to its central repo, and then push the parent project, so that when it tries to update submodules elsewhere, its able to fetch them. If as I suspect, the origin for your third-party libraries is something public that you dont have push access to, youre going to have to set up your own central repositories for the submodules. When you initialize one, it tries to clone from that origin, and updating it often requires fetching from that origin. You havent given any information about where your submodules came from, but a submodule is aware of its origin, just like your repository is. Afterwards, when your hook runs git checkout -f after pushing, itll also need to run git submodule update (again with the work tree appropriately set).īut its more complicated than this. It looks like youve got a setup with your work tree separate from your repo, so just like with that git checkout -f, youll need to accommodate that: GIT_WORK_TREE=/path/to/whatever git submodule update -init.
Youll need to at some point initialize the submodules on your server. So a server only aware of the parent project, which hasnt populated the submodules, will naturally see nothing in them. The point of submodules is that they are git repositories within repositories, and the parent repo only knows what commit should be checked out in the submodule – it knows nothing about the content. Git: how to push submodule to a remote repository?