How can I pull submodule commits from a central repository, without pushing the submodule commits to the submodule's upstream repository?
For example, let's say I have a central git repository A which I clone:
git clone /path/to/A myA1 Now I add some repository, which I don't own, as a submodule:
git submodule add https://.../B.git myB git commit -m "Added B submodule" I add some changes to the B submodule and commit them:
cd myB echo foo >> x.txt git add x.txt git commit -m "changes in local B" cd - git commit -m "changes in submodule" git push # push commits in local myA1 to central repo A But I can't push the commits in myB upstream to B, because I can't write to B (it's some repository on Github). When my coworkers clone the central repository A, their submodule refers to the upstream B repository, not the one in A:
git clone /path/to/A myA2 Their url entry in .gitmodules points to https://.../B.git, which doesn't contain my commit changes.
How can they pull the changes I committed to my B submodule?